import type {
  ControllerResponse,
  ExamGetAnswerSheetResponse,
  ExamStatisticsQuestionAnalysisRequestVO,
  ExamStatisticsQuestionAnalysisResponseVO,
  ExamStatisticsQuestionRankingResponseVO,
  ExamStatisticsScoreAnalysisResponseVO,
  ExamStatisticsStatisticsAnalysisResponseVO,
  ModelCreateTeacherAttentionStudentRequest,
  ModelExportScoreSheetRequest,
  ModelGetClassStudentScoreListRequest,
  ModelGetClassStudentScoreListResponse,
  ModelGetKeyStudentRequest,
  ModelGetKeyStudentResponse,
  ModelGetPersonalReportRequest,
  ModelGetPersonalReportResponse,
  ModelGetRecentExamStatsRequest,
  ModelGetRecentExamStatsResponse,
  ModelGetScoreSheetRequest,
  ModelGetScoreSheetResponse,
  ModelGetStudentExamHistoryRequest,
  ModelGetStudentExamHistoryResponse,
  ModelGetStudentListRequest,
  ModelGetStudentListResponse,
  ModelGetTrendRequest,
  ModelGetTrendResponse,
  ModelQuestionAnalysisRequest,
  ModelScoreAnalysisRequest,
  ModelStatisticsAnalysisRequest,
  ModelTeacherAnalysisResponse,
} from './data-contracts'

import httpClient from '@/utils/http'

export default {
  /**
   * @description 老师关注指定学号的学生
   */
  attentionStudentCreate: (request: ModelCreateTeacherAttentionStudentRequest) => {
    return httpClient.post<
      ControllerResponse & {
        message?: string
      }
    >(`/teacher-analysis/attention-student`, { params: request })
  },
  /**
   * @description 获取指定班级下所有学生的成绩列表
   */
  classStudentScoreListCreate: (request: ModelGetClassStudentScoreListRequest) => {
    return httpClient.post<
      ControllerResponse & {
        /** 获取班级下所有学生成绩列表的响应数据 */
        data?: ModelGetClassStudentScoreListResponse
      }
    >(`/teacher-analysis/class-student-score-list`, { params: request })
  },
  /**
   * @description 获取老师所带科目和考试信息，用于PC端成绩分析模块
   */
  dataList: () => {
    return httpClient.get<
      ControllerResponse & {
        /** 老师成绩分析接口响应 */
        data?: ModelTeacherAnalysisResponse
      }
    >(`/teacher-analysis/data`)
  },
  /**
   * @description 导出指定考试、科目的试题统计分析数据Excel文件，并上传到存储服务
   */
  exportQuestionAnalysisCreate: (request: ModelQuestionAnalysisRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: Record<string, string>
      }
    >(`/teacher-analysis/export-question-analysis`, { params: request })
  },
  /**
   * @description 导出指定考试、科目、班级的小题分排名列表Excel文件，并上传到存储服务
   */
  exportQuestionRankingCreate: (request: ModelQuestionAnalysisRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: Record<string, string>
      }
    >(`/teacher-analysis/export-question-ranking`, { params: request })
  },
  /**
   * @description 导出指定考试、科目、年级、班级的成绩单Excel文件
   */
  exportScoreSheetCreate: (request: ModelExportScoreSheetRequest) => {
    return httpClient.download<Blob>(`/teacher-analysis/export-score-sheet`, { params: request })
  },
  /**
   * @description 导出指定考试、科目的分数段、名次段或比例段统计分析数据Excel文件，并上传到存储服务
   */
  exportStatisticsAnalysisCreate: (request: ModelStatisticsAnalysisRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: Record<string, string>
      }
    >(`/teacher-analysis/export-statistics-analysis`, { params: request })
  },
  /**
   * @description 获取指定科目、年级、班级的重点学生情况，支持上升和下降趋势筛选
   */
  keyStudentCreate: (request: ModelGetKeyStudentRequest) => {
    return httpClient.post<
      ControllerResponse & {
        /** 获取重点学生情况的响应数据 */
        data?: ModelGetKeyStudentResponse
      }
    >(`/teacher-analysis/key-student`, { params: request })
  },
  /**
   * @description 获取指定学生的个人成绩报告，包含考试总结、学习情况分析和难度分析
   */
  personalReportCreate: (request: ModelGetPersonalReportRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ModelGetPersonalReportResponse
      }
    >(`/teacher-analysis/personal-report`, { params: request })
  },
  /**
   * @description 获取指定考试、科目的试题统计分析数据
   */
  questionAnalysisCreate: (request: ExamStatisticsQuestionAnalysisRequestVO) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamStatisticsQuestionAnalysisResponseVO
      }
    >(`/teacher-analysis/question-analysis`, { params: request })
  },
  /**
   * @description 获取指定考试、科目、班级的小题分排名列表
   */
  questionRankingCreate: (request: ModelQuestionAnalysisRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamStatisticsQuestionRankingResponseVO
      }
    >(`/teacher-analysis/question-ranking`, { params: request })
  },
  /**
   * @description 获取指定科目、年级、班级的最近考试统计数据
   */
  recentExamStatsCreate: (request: ModelGetRecentExamStatsRequest) => {
    return httpClient.post<
      ControllerResponse & {
        /** 获取最近考试情况的响应数据 */
        data?: ModelGetRecentExamStatsResponse
      }
    >(`/teacher-analysis/recent-exam-stats`, { params: request })
  },
  /**
   * @description 获取指定考试、科目的均分对比分析数据
   */
  scoreAnalysisCreate: (request: ModelScoreAnalysisRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamStatisticsScoreAnalysisResponseVO
      }
    >(`/teacher-analysis/score-analysis`, { params: request })
  },
  /**
   * @description 获取指定考试、科目、年级、班级的成绩单
   */
  scoreSheetCreate: (request: ModelGetScoreSheetRequest) => {
    return httpClient.post<
      ControllerResponse & {
        /** 获取成绩单的响应数据 */
        data?: ModelGetScoreSheetResponse
      }
    >(`/teacher-analysis/score-sheet`, { params: request })
  },
  /**
   * @description 获取指定考试、科目的分数段、名次段或比例段统计分析数据
   */
  statisticsAnalysisCreate: (request: ModelStatisticsAnalysisRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ExamStatisticsStatisticsAnalysisResponseVO
      }
    >(`/teacher-analysis/statistics-analysis`, { params: request })
  },
  /**
   * @description 获取指定学生的历次考试详情
   */
  studentExamHistoryCreate: (request: ModelGetStudentExamHistoryRequest) => {
    return httpClient.post<
      ControllerResponse & {
        /** 获取个人历次考试详情的响应数据 */
        data?: ModelGetStudentExamHistoryResponse
      }
    >(`/teacher-analysis/student-exam-history`, { params: request })
  },
  /**
   * @description 获取指定考试科目、年级、班级的学生列表，分为已关注和其他学生
   */
  studentListCreate: (request: ModelGetStudentListRequest) => {
    return httpClient.post<
      ControllerResponse & {
        data?: ModelGetStudentListResponse
      }
    >(`/teacher-analysis/student-list`, { params: request })
  },
  /**
   * @description 获取指定科目、年级、班级的平均分走势数据
   */
  trendCreate: (request: ModelGetTrendRequest) => {
    return httpClient.post<
      ControllerResponse & {
        /** 获取班级和年级平均分走势的响应数据 */
        data?: ModelGetTrendResponse
      }
    >(`/teacher-analysis/trend`, { params: request })
  },
  /**
   * @description 根据答题卡ID获取答题卡详细信息，包括学生信息、成绩信息、客观题答案、主观题答案等
   */
  teacherAnalysisDetail: (infoId: number) => {
    return httpClient.get<
      ControllerResponse & {
        /** 获取答题卡响应体 */
        data?: ExamGetAnswerSheetResponse
      }
    >(`/teacher-analysis/${infoId}`)
  },
}
