package com.qmth.distributed.print.business.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailPdfDownloadDto;
import com.qmth.distributed.print.business.bean.params.RelatePaperParam;
import com.qmth.distributed.print.business.entity.ExamDetailCourse;
import com.qmth.distributed.print.business.entity.ExamTaskDetail;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 命题任务明细表（入库申请） 服务类
 * </p>
 *
 * @author xf
 * @since 2021-03-23
 */
public interface ExamTaskDetailService extends IService<ExamTaskDetail> {

    boolean enable(ExamTaskDetail examTaskDetail) throws IOException;

    boolean updatePaper(RelatePaperParam paperParam) throws IOException;

    List<ExamTaskDetailDto> list(Long semesterId, Long examId, String relateType, List<Long> printPlanId, String courseCode, String paperNumber, String userName, Long cardRuleId);

    Map listTotal(Long semesterId, Long examId, String relateType, List<Long> printPlanId, String courseCode, String paperNumber, String userName, Long cardRuleId);

    void resetCardId(Long id);

    Map<String, Object> paperUpdate(ExamTaskDetail examTaskDetail);

    /**
     * 重启流程
     *
     * @param examTaskDetail
     * @return
     */
    Map<String, Object> taskRestart(ExamTaskDetail examTaskDetail);

    ExamTaskDetail getByExamTaskIdNotValid(Long examTaskId);
    ExamTaskDetail getByExamTaskId(Long examTaskId);

    /**
     * 根据card查找json
     *
     * @param cardId
     * @return
     */
    List<ExamTaskDetail> getExamTaskDetailByCardIdJson(Long cardId);

    /**
     * 根据examTaskId下载pdf
     *
     * @param examTaskId
     * @return
     */
    ExamTaskDetailPdfDownloadDto findPdfDownload(Long examTaskId);

    List<String> listRelateCommonTypes(Long semesterId, Long examId, String relateType, List<Long> idList, String courseCode, String paperNumber, String userName, Long cardRuleId);

    ExamTaskDetail findByExamIdAndCourseCodeAndPaperNumber(Long examId, String code, String number);

    boolean cancel(Long id, String cancelRemark);

    ExamTaskDetail getByExamIdAndCourseCodeAndPaperNumber(Long examId, String courseCode, String paperNumber);

    void updateExposePaperType(Long examId, List<ExamDetailCourse> listByExamDetailId);
}
