import httpClient from '@/utils/http';

import {
  ControllerResponse,
  ExamMarkingProgressResponse,
  ExamQuestionMarkingProgressResponse,
  ExamResumeMarkingRequest,
  ExamResumeMarkingResponse,
  ExamSuspendMarkingRequest,
  ExamSuspendMarkingResponse
} from './data-contracts';
export default {
  /**
   * @description 根据exam_subject_id查询阅卷进度，包括大题、小题、总分、评选方式、总任务量、已统分量和进度百分比
   */
  markingProgressList: (query: {
    /** 考试科目ID */
    exam_subject_id: number;
  }) => {
    return httpClient.get<
      ControllerResponse & {
        data?: ExamMarkingProgressResponse;
      }
    >(`/marking-progress`, { query: query });
  },
  /**
   * @description 根据exam_subject_id导出阅卷进度Excel文件，包含学校、老师、已阅数、总任务数等详细信息
   */
  exportList: (query: {
    /** 考试科目ID */
    exam_subject_id: number;
  }) => {
    return httpClient.get<
      ControllerResponse & {
        data?: string;
      }
    >(`/marking-progress/export`, { query: query });
  },
  /**
   * @description 根据question_id查询题目的阅卷进度，包括任务类型、学校、老师的阅卷情况
   */
  questionList: (query: {
    /** 题目ID */
    question_id: number;
  }) => {
    return httpClient.get<
      ControllerResponse & {
        data?: ExamQuestionMarkingProgressResponse;
      }
    >(`/marking-progress/question`, { query: query });
  },
  /**
   * @description 根据resume_type和id恢复阅卷，更新exam_subject_answer_sheet_template_question表中的marking_status字段为normal
   */
  resumeCreate: (request: ExamResumeMarkingRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamResumeMarkingResponse;
      }
    >(`/marking-progress/resume`, { params: request });
  },
  /**
   * @description 根据suspend_type和id暂停阅卷，更新exam_subject_answer_sheet_template_question表中的marking_status字段为suspend
   */
  suspendCreate: (request: ExamSuspendMarkingRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamSuspendMarkingResponse;
      }
    >(`/marking-progress/suspend`, { params: request });
  }
};
