// src/api/analysis.ts  分析相关的接口
import request from "../utils/request.ts";
import type { ApiResponse } from "@/types/types"; // 引入类型

// 查询头部筛选信息
export const findCommonSelectList = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/find_common_select_list",
    method: "get",
    params: data,
  });
};
// 获取任务的相关配置和信息
export const getAnalysisExamInfo = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/getAnalysisExamInfo",
    method: "get",
    params: data,
  });
};
// 根据选择题判分系统ID获取考试的examId
export const getIdByAiExamId = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/get_id_by_ai_exam_id",
    method: "get",
    params: data,
  });
};
//是否显示分组分析菜单
export const queryQuestionGroupByAiId = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/queryQuestionGroupByAiId?aiExamId=" + data,
    method: "get",
  });
};
// ==========================================成绩单============================================
//获取单科成绩单下的表头数据
export const studentTranscriptTitle = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/studentTranscriptTitle",
    method: "post",
    data,
  });
};
//查询分析报告统计信息
export const queryJointStudentStatistics = (
  data: any,
): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/queryJointStudentStatistics",
    method: "post",
    data,
  });
};
//查询单科成绩单下的数据
export const studentTranscript = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/studentTranscript",
    method: "post",
    data,
  });
};
// 导出单科成绩单下的数据
export const studentTranscriptExcel = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/excel/studentTranscript",
    method: "post",
    data,
    responseType: "blob",
  });
};
// ==========================================错题分析============================================
// 错题分析
export const errorQuestionAnalysis = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/errorQuestionAnalysis",
    method: "post",
    data,
  });
};
// 导出错题分析数据
export const exportErrorQuestion = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/excel/export_error_question",
    method: "post",
    data,
    responseType: "blob",
  });
};
// ==========================================水平分布============================================
export const scoreSegment = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/scoreSegment",
    method: "post",
    data,
  });
};
// 获取水平分布学生弹窗数据
export const horizontalDistributionStudentInfo = (
  data: any,
): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/horizontalDistributionStudentInfo",
    method: "post",
    data,
  });
};
// ==========================================班级对比============================================
export const classContrastSubjectTable = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/classContrastSubjectTable",
    method: "post",
    data,
  });
};
// 对比获取学生弹窗数据
export const contrastStudentInfo = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/contrastStudentInfo",
    method: "post",
    data,
  });
};
// 导出
export const publicExportFive = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/excel/publicExport_five",
    method: "post",
    data,
    responseType: "blob",
  });
};
// ==========================================小题分析============================================
export const questionAnalysis = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/questionAnalysis",
    method: "post",
    data,
  });
};
// 通过答案或者分数查询某题作答情况
export const queryAnswerListByAnswerAndScore = (
  data: any,
): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/queryAnswerListByAnswerAndScore",
    method: "post",
    data,
  });
};
//小题分析获取学生弹窗
export const questionStudentInfo = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/questionStudentInfo",
    method: "post",
    data,
  });
};
//小题分组分析获取学生弹窗
export const questionGroupStudentInfo = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/questionGroupStudentInfo",
    method: "post",
    data,
  });
};
// ==========================================分组分析============================================
export const questionGroupAnalysis = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/questionGroupAnalysis",
    method: "post",
    data,
  });
};
// ==========================================选项分析============================================
// 客观题分析（选择题分析图）
export const selectQuestionAnalysis = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/selectQuestionAnalysis",
    method: "post",
    data,
  });
};
// 选择题分析表-分页
export const selectQuestionAnalysisPage = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/selectQuestionAnalysisPage",
    method: "post",
    data,
  });
};
//分页获取学生作答
export const selectQuestionStudentPageList = (
  data: any,
): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/selectQuestionPageList",
    method: "post",
    data,
  });
};
// ==========================================命题分析============================================
export const propositionAnalysis = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/propositionAnalysis",
    method: "post",
    data,
  });
};
// 导出选项分析表
export const exportObjectAnalysis = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/excel/exportObjectAnalysis",
    method: "post",
    data,
    responseType: "blob",
  });
};
// 试卷分析客观题作答学生
export const publicExportSelectQuestion = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/excel/publicExport_selectQuestion",
    method: "post",
    data,
    responseType: "blob",
  });
};

// ==========================================答题卡============================================
//查询学生答题卡带批阅痕迹的（多张）
export const findCardListNew = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/find_card_list_new",
    method: "post",
    data,
  });
};
//查询学生答题卡带批阅痕迹的
export const getStudentPaperCardInfo = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/find_student_card",
    method: "post",
    data,
  });
};
//编辑采分点
export const editSamplingPoint = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/update_sampling_point",
    method: "post",
    data,
  });
};
// ==========================================导出============================================
//公共导出接口-表头和内容渲染完毕
export const publicExport = (data: any): Promise<ApiResponse> => {
  return request({
    url: "/api/v1/ai_analysis/excel/publicExport",
    method: "post",
    data,
    responseType: "blob",
  });
};
