import axios from 'axios';
import {
  ExamListPageParam,
  ExamListPageRes,
  ExamItem,
  ExamUpdateParam,
  ExamStatDetailInfo,
} from './types/exam';

// 考试列表
export function getExamList(
  params: ExamListPageParam
): Promise<ExamListPageRes> {
  return axios.post('/api/exam/list', {}, { params });
}
// 考试详情
export function getExamDetail(examId: number): Promise<ExamItem> {
  return axios.post('/api/exam/detail', {}, { examId });
}

// 新增或编辑考试
export function updateExam(data: ExamUpdateParam): Promise<ExamItem> {
  return axios.post('/api/exam/update', data);
}

// 获取考试统计详情信息
export function getExamStatisticInfo(
  examId: number
): Promise<ExamStatDetailInfo> {
  return axios.post('/api/exam/statistic', {}, { params: { examId } });
}
