import axios from 'axios';
import {
  RejectListPageParams,
  RejectListPageRes,
  RejectStatisticsListParams,
  RejectStatisticsListRes,
  RejectTypeItem,
  RejectTypeUpdateParam,
} from './types/reject';

// 获取打回列表
export function getRejectList(
  params: RejectListPageParams
): Promise<RejectListPageRes> {
  return axios.post('/api/student/list', {}, { params });
}
// 获取打回记录列表
export function getRejectRecordList(
  params: RejectListPageParams
): Promise<RejectListPageRes> {
  return axios.post('/api/student/list', {}, { params });
}

// 获取打回统计列表
export function getRejectStatisticsList(
  params: RejectStatisticsListParams
): Promise<RejectStatisticsListRes> {
  return axios.post('/api/student/list', {}, { params });
}

// 查询打回类型
export function getRejectTypeList(examId: number): Promise<RejectTypeItem[]> {
  return axios.post(
    '/api/admin/exam/reject/type/list',
    {},
    { params: { examId } }
  );
}
// 新增/修改打回类型
export function updateRejectType(params: RejectTypeUpdateParam): Promise<any> {
  if (params.id) {
    return axios.post('/api/admin/exam/reject/type/update', params);
  }
  return axios.post('/api/admin/exam/reject/type/save', {}, params);
}
// 删除打回类型
export function deleteRejectType(id: number): Promise<any> {
  return axios.post(
    '/api/admin/exam/reject/type/delete',
    {},
    { params: { id } }
  );
}
