import axios from 'axios';
import {
  CardData,
  Task,
  StudentObjectiveInfo,
  SemesterItem,
  ExamItem,
  CourseItem,
  TrackExportListParams,
  TrackExportListPageRes,
  TrackExportDetailListParams,
  CourseQueryParams,
  PaperNumberQueryParams,
  TrackExportDetailListPageRes,
} from './types/task';

// semester
export function semesterQuery(): Promise<SemesterItem[]> {
  return axios.post('/api/admin/basic/condition/list_semester', {});
}
// exam
export function examQuery(semesterId: string): Promise<ExamItem[]> {
  return axios.post(
    '/api/admin/basic/condition/list_exam',
    {},
    {
      params: { semesterId },
    }
  );
}
// course
export function courseQuery(params: CourseQueryParams): Promise<CourseItem[]> {
  return axios.post(
    '/api/admin/basic/condition/list_course',
    {},
    {
      params,
    }
  );
}
// paper_number
export function paperNumberQuery(
  params: PaperNumberQueryParams
): Promise<string[]> {
  return axios.post(
    '/api/admin/basic/condition/list_paper_number',
    {},
    {
      params,
    }
  );
}

// 导出科目查询列表
export async function trackExportListPage(
  params: TrackExportListParams
): Promise<TrackExportListPageRes> {
  return axios.post('/api/admin/mark/archive/score/list', {}, { params });
  // 测试专用：成绩检查
  // return axios.post('/api/admin/mark/setting/scoreList', {}, { params });
}
// 导出科目学生明细查询列表
export async function trackExportDetailListPage(
  params: TrackExportDetailListParams
): Promise<TrackExportDetailListPageRes> {
  return axios.post('/api/admin/mark/archive/student/list', {}, { params });
  // 测试专用：成绩检查
  // return axios.post('/api/admin/mark/student/score', {}, { params });
}

/** 查看单个学生的试卷轨迹 */
export async function getSingleStudentTaskOfStudentTrack(
  studentId: string
): Promise<Task> {
  return axios.post(
    '/api/admin/mark/track/getTask',
    {},
    { params: { studentId } }
  );
}
/** 查看单个学生的试卷的题卡 */
export async function getSingleStudentCardData(
  studentId: string
): Promise<CardData> {
  return axios.post(
    '/api/admin/mark/track/getCard',
    {},
    { params: { studentId } }
  );
}

/** 获取学生客观题数据 */
export async function studentObjectiveConfirmData(
  studentId: string
): Promise<StudentObjectiveInfo> {
  return axios.post(
    '/api/admin/mark/inspected/objective/getTask',
    {},
    { params: { studentId } }
  );
}
