package com.vctgo.system.api.factory;

import com.vctgo.common.core.domain.R;
import com.vctgo.system.api.RemoteExpertWorkingPlatformService;
import com.vctgo.system.api.domain.VoteEvents;
import com.vctgo.system.api.domain.VoteScoringItem;
import com.vctgo.system.api.domain.VoteSubmission;
import com.vctgo.system.api.domain.vo.VoteExpertSubmissionCountVo;
import com.vctgo.system.api.domain.vo.VoteExpertSubmissionVo;
import com.vctgo.system.api.domain.vo.VoteExpertWorkingPlatformVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteExpertWorkingPlatformFactory implements FallbackFactory<RemoteExpertWorkingPlatformService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteExpertWorkingPlatformFactory.class);
    @Override
    public RemoteExpertWorkingPlatformService create(Throwable throwable) {
        log.error("专家工作平台服务调用失败:{}", throwable.getMessage());
        return new RemoteExpertWorkingPlatformService() {
            @Override
            public R<List<VoteExpertWorkingPlatformVo>> expertPlatformPage(String judgesId) {
                return R.fail("专家公共平台列表调用失败:" + throwable.getMessage());
            }

            @Override
            public R<List<VoteExpertSubmissionVo>> expertPlatformDetail(Long eventId, Long workSettingsId, Long roundId,String status) {
                return R.fail("专家评选作品列表调用失败:" + throwable.getMessage());
            }

            @Override
            public R<VoteExpertSubmissionCountVo> submissionCount(Long eventId, Long workSettingsId, Long roundId) {
                return R.fail("专家作品数列表调用失败:" + throwable.getMessage());
            }

            @Override
            public R<List<VoteScoringItem>> getItem(Long ruleId) {
                return R.fail("获取评分项规则失败:" + throwable.getMessage());
            }

            @Override
            public R<VoteEvents> getEventDetails(Long eventId) {
                return R.fail("获取活动列表失败:" + throwable.getMessage());
            }

            @Override
            public R<VoteSubmission> submissionDetails(Long eventId, Long workSettingsId, Long roundId, Long submissionId) {
                return R.fail("获取作品详情失败:" + throwable.getMessage());
            }

            @Override
            public R<Integer> expertScoring(String encode) {
                return R.fail("评分失败:" + throwable.getMessage());
            }
        };
    }
}
