package com.zd.system.api.exam;

import com.zd.common.core.constant.ServiceNameConstants;
import com.zd.common.core.domain.R;
import com.zd.common.core.web.page.TableDataInfo;
import com.zd.system.api.exam.domain.ElResources;
import com.zd.system.api.factory.RemoteExamFallbackFactory;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 考试服务Feign调用接口
 *
 * @Author: zhoupan
 * @Date: 2021/09/03/14:29
 * @Description:
 */
@FeignClient(contextId = "remoteExamService", value = ServiceNameConstants.EXAM_SERVICE, fallbackFactory = RemoteExamFallbackFactory.class)
public interface RemoteExamService {

    /**
     * 查询在线考试列表（用户相关，区分列表接口）
     */
    @GetMapping(value = "/exam/onlineExamList")
    @ApiOperation(value = "分页查询当前用户考试列表")
    public TableDataInfo list(@RequestParam Map exam);

    /**
     * 去考试自动创建试卷
     */
    @ApiOperation(value = "去考试自动创建试卷")
    @PostMapping(value = "/paper/create-paper")
    public R<Object> createPaper(@RequestBody Map elPaper);

    /**
     * 交卷操作
     */
    @ApiOperation(value = "交卷操作")
    @PostMapping(value = "/paper/handPaper")
    public R<Object> handPaper(@RequestBody Map id);

    /**
     * 答题过程根据 paperId 和 quId 查询问题和选项
     */
    @ApiOperation(value = "查询问题和选项")
    @PostMapping(value = "/paper/paperDetail")
    public R<Object> queryQuDetail(@RequestBody Map paperQu);

    /**
     * 填充答案 下一题实时保存上题答案
     *
     * @param paperQuMap
     */
    @ApiOperation(value = "保存用户答案")
    @PostMapping(value = "/paper/fillAnswer")
    public R<Object> fillAnswer(@RequestBody Map<String,Object> paperQuMap);

    /**
     * 获取试卷管理详细信息（答题卡信息）
     */
    @GetMapping(value = "/paper/{id}")
    public R<Object> getInfo(@PathVariable("id") Long id);


    /**
     * 根据用户id，修改积分内容
     */
    @PostMapping(value = "/points/record/recoveryPoints")
    public R<Object> recoveryPoints(@RequestBody Map<String,Object> recovery);

    /**
     * 根据积分类型，扣除积分相关内容
     */
    @PostMapping(value = "/points/record/deductionPoints")
    public R<Object> deductionPoints(@RequestBody Map<String,Object> deductionPoint);

    /**
     * 获取积分配置表信息
     */
    @PostMapping(value = "/markconfig/getPointsConfig")
    public R<Object> getPointsConfig(@RequestBody Map<String,Object> markconfig);


    /**
     * 初始化奖励积分
     */
    @PostMapping(value = "/points/record/initCreditPoints")
    public R<Object> initCreditPoints(@RequestBody Map<String,Object> initMap);


    /**
     * 获取奖励分接口
     */
    @PostMapping(value = "/points/record/obtainBonusPoints")
    public R<Object> obtainBonusPoints(@RequestBody Map<String,Object> obtainMap);


    /**
     * 获取上月未违规记录接口
     */
    @PostMapping(value = "/points/record/getLastMonthViolation")
    public R<Object> getLastMonthViolation(@RequestBody Map<String,Object> obtainMap);


    /**
     * 交卷查询考试结果
     */
    @ApiOperation(value = "查询考试结果")
    @PostMapping(value = "/paper/paperResult")
    public R<Map> paperResult(Map elPaper);

    /**
     * 查询当前用户考试记录列表
     */
    @GetMapping("/paper/appListAll")
    public TableDataInfo myExamResultList(Map elUserExam);

    /**
     * 根据登录用户查询 我的证书列表
     */
    @PostMapping("/exam/queryMyCert")
    public TableDataInfo queryMyCert(Map<String, Object> userCert);

    /**
     * 考试过程 查询当前考题的正确和错误数量
     */
    @GetMapping(value = "/paper/paperStatistics/{id}")
    public R<Object> getPaperStatistics(@PathVariable("id") Long id);

    /**
     * 超时弃考
     */
    @ApiOperation(value = "超时弃考")
    @PostMapping(value = "/paper/abandon")
    public void abandonPaper();


    /**
     * 根据登录用户查询 我的积分列表
     */
    @PostMapping("/points/record/list/myApp")
    public TableDataInfo recordMyApp(@RequestBody Map<String, Object> myApp);

    /**
     * 根据登录用户查询 我的积分统计
     */
    @PostMapping("/points/record/count/myApp")
    public R<Object> recordMyAppCount();

    @PostMapping("/points/record/exits")
    public R<Object> findByUserId(@RequestBody Map<String, Object> map);

    /**
     * 进入/出加奖励分
     * @param map
     * @return
     */
    @PostMapping("/rewardconfig/addloginfo")
    public R addLoginfo(@RequestBody Map map);

    /**
     * 获取奖励分配置表信息
     * @param map
     * @return
     */
    @PostMapping("/rewardconfig/getBonusPointsConfig")
    public R getBonusPointsConfig(@RequestBody Map map);

    /**
     * 获取所有的学习资源
     * @return
     */
    @RequestMapping("/el_resources/listAll")
    public R<List<ElResources>> listAll();

}
