import axios from 'axios';
import {
  IssuePaperListPageRes,
  IssuePaperListPageParam,
  IssuePaperTypeItem,
  IssuePaperTypeUpdateParam,
} from './types/issue-paper';

// 获取问题卷列表
export function getIssuePaperList(
  params: IssuePaperListPageParam
): Promise<IssuePaperListPageRes> {
  return axios.post('/api/score/list', {}, { params });
}

// 重置问题卷
export function resetIssuePaper(ids: number[]): Promise<any> {
  return axios.post('/api/score/reset', { ids });
}

// 查询问题卷类型
export function getIssuePaperTypeList(
  examId: number
): Promise<IssuePaperTypeItem[]> {
  return axios.post('/api/score/type/list', {}, { params: { examId } });
}

// 新增/修改问题卷类型
export function updateIssuePaperType(
  params: IssuePaperTypeUpdateParam
): Promise<any> {
  return axios.post('/api/score/type/add', params);
}
// 删除问题卷类型
export function deleteIssuePaperType(id: number): Promise<any> {
  return axios.post('/api/score/type/delete', {}, { params: { id } });
}
