import httpClient from '@/utils/http';

import {
  ControllerResponse,
  ExamCreateMarkingTaskRecordRequest,
  ExamHandleProblemRecordResponse,
  ExamProblemSheetListResponse,
  ExamProblemSheetStatisticsResponse,
  ExamStudentMarkingQuestionResponse
} from './data-contracts';
export default {
  /**
   * @description 根据考试科目ID分页查询问题卷列表，包含处理状态统计和详细信息（考试科目、教师信息、问题卷类型等）
   */
  listList: (query: {
    /**
     * 考试科目ID
     * @format int64
     */
    exam_subject_id: number;
    /** 页码，从1开始，默认1 */
    page?: number;
    /** 每页数量，默认20，最大100 */
    page_size?: number;
  }) => {
    return httpClient.get<
      ControllerResponse & {
        data?: ExamProblemSheetListResponse;
      }
    >(`/problem-sheet/list`, { query: query });
  },
  /**
   * @description 处理问题卷记录
   */
  problemCreate: (record: ExamCreateMarkingTaskRecordRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamHandleProblemRecordResponse;
      }
    >(`/problem-sheet/problem`, { params: record });
  },
  /**
   * @description 根据题目ID返回题目信息
   */
  questionDetail: (questionId: number) => {
    return httpClient.get<
      ControllerResponse & {
        data?: ExamStudentMarkingQuestionResponse;
      }
    >(`/problem-sheet/question/${questionId}`);
  },
  /**
   * @description 根据考试科目ID获取问题卷统计信息，按题目分组统计待处理、已处理、总数量，支持分页
   */
  statisticsList: (query: {
    /** 考试科目ID */
    exam_subject_id: number;
    /** 页码，从1开始，默认1 */
    page?: number;
    /** 每页数量，默认20，最大100 */
    page_size?: number;
  }) => {
    return httpClient.get<
      ControllerResponse & {
        data?: ExamProblemSheetStatisticsResponse;
      }
    >(`/problem-sheet/statistics`, { query: query });
  }
};
