import httpClient from '@/utils/http';

import {
  ControllerResponse,
  ExamClassMatchRequest,
  ExamCreateScanAnswerSheetBatchRequest,
  ExamDeleteScanAnswerSheetBatchRequest,
  ExamGetAnswerDetailMarkingResponse,
  ExamGetScanAnswerSheetBatchCountResponse,
  ExamGetScanAnswerSheetBatchDetailResponse,
  ExamGetScanAnswerSheetBatchListDetailRequest,
  ExamGetScanAnswerSheetBatchListDetailResponse,
  ExamGetScanAnswerSheetBatchListRequest,
  ExamGetScanProcessDetailRequest,
  ExamGetScanProcessDetailResponse,
  ExamSaveUploadRequest,
  ExamScanTransferRequest,
  ExamUpdateAnswerDetailMarkingRequest,
  ExamUpdateScanAnswerSheetRelationRequest,
  ExamUpdateScanAnswerSheetsRequest
} from './data-contracts';
export default {
  /**
   * @description 更新答题详情的备注、优秀标记、典型标记、问题卷标记等信息
   */
  answerDetailMarkingUpdateCreate: (request: ExamUpdateAnswerDetailMarkingRequest) => {
    return httpClient.post<
      ControllerResponse & {
        message?: string;
      }
    >(`/scan-answer-sheet/answer-detail/marking/update`, { params: request });
  },
  /**
   * @description 获取答题详情的备注、优秀标记、典型标记、问题卷标记等信息
   */
  answerDetailMarkingDetail: (id: number) => {
    return httpClient.get<
      ControllerResponse & {
        /** 获取答题详情标记信息响应体 */
        data?: ExamGetAnswerDetailMarkingResponse;
      }
    >(`/scan-answer-sheet/answer-detail/marking/${id}`);
  },
  /**
   * @description 创建扫描答题卡批次
   */
  batchCreateCreate: (request: ExamCreateScanAnswerSheetBatchRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: object;
      }
    >(`/scan-answer-sheet/batch/create`, { params: request });
  },
  /**
   * @description 删除扫描答题卡批次
   */
  batchDeleteCreate: (request: ExamDeleteScanAnswerSheetBatchRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: object;
      }
    >(`/scan-answer-sheet/batch/delete`, { params: request });
  },
  /**
   * @description 获取答题卡批次
   */
  batchListCreate: (request: ExamGetScanAnswerSheetBatchListRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamGetScanAnswerSheetBatchCountResponse[];
      }
    >(`/scan-answer-sheet/batch/list`, { params: request });
  },
  /**
   * @description 获取答题卡批次列表详情
   */
  batchListDetailCreate: (request: ExamGetScanAnswerSheetBatchListDetailRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamGetScanAnswerSheetBatchListDetailResponse[];
      }
    >(`/scan-answer-sheet/batch/list-detail`, { params: request });
  },
  /**
   * @description 答题卡详情
   */
  batchProcessList: (query: {
    /** 考试ID */
    exam_id: number;
    /** 考试科目ID */
    exam_subject_id: number;
  }) => {
    return httpClient.get<
      ControllerResponse & {
        data?: ExamGetScanProcessDetailResponse;
      }
    >(`/scan-answer-sheet/batch/process`, { query: query });
  },
  /**
   * @description 保存并上传答题卡信息
   */
  batchSaveUploadCreate: (request: ExamSaveUploadRequest) => {
    return httpClient.post<
      ControllerResponse & {
        message?: string;
      }
    >(`/scan-answer-sheet/batch/save-upload`, { params: request });
  },
  /**
   * @description 批量转移已扫描答题卡到其它科目接口
   */
  batchTransferCreate: (request: ExamScanTransferRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: string;
      }
    >(`/scan-answer-sheet/batch/transfer`, { params: request });
  },
  /**
   * @description 批量更新扫描答题卡信息
   */
  batchUpdateCreate: (request: ExamUpdateScanAnswerSheetsRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: object;
      }
    >(`/scan-answer-sheet/batch/update`, { params: request });
  },
  /**
   * @description 按班级匹配统计接口
   */
  classMatchCreate: (request: ExamClassMatchRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: string;
      }
    >(`/scan-answer-sheet/class-match`, { params: request });
  },
  /**
   * @description 获取班级匹配详情，支持按上传状态筛选
   */
  classMatchDetailCreate: (request: ExamClassMatchRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: object;
      }
    >(`/scan-answer-sheet/class-match-detail`, { params: request });
  },
  /**
   * @description 获取答题卡批次详情
   */
  detailCreate: (request: ExamGetScanProcessDetailRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamGetScanAnswerSheetBatchDetailResponse;
      }
    >(`/scan-answer-sheet/detail`, { params: request });
  },
  /**
   * @description 批量转移至其他科目[暂时不用]
   */
  newExamSubjectUpdate: (request: ExamUpdateScanAnswerSheetRelationRequest) => {
    return httpClient.put<
      ControllerResponse & {
        data?: object;
      }
    >(`/scan-answer-sheet/new-exam-subject`, { params: request });
  }
};
