import axios, { AxiosResponse } from 'axios';
import {
  ImageCheckDataListFilter,
  ImageCheckPageParams,
  ImageCheckPageRes,
  ManualConfirmDataListFilter,
  ManualConfirmPageRes,
  ResultCheckDataListFilter,
  CheckRes,
} from './types/check';

// 人工确认查询
export function getManualConfirmDataList(
  params: ManualConfirmDataListFilter
): Promise<ManualConfirmPageRes> {
  return axios.post('/api/admin/exam/check/student/list', {}, { params });
}

// 图片检查查询
export function getImageCheckDataList(
  params: ImageCheckPageParams
): Promise<ImageCheckPageRes> {
  return axios.post('/api/admin/exam/check/image/list', {}, { params });
}

// 导出图片检查数据
export function exportImageCheckData(
  params: ImageCheckDataListFilter
): Promise<AxiosResponse<Blob>> {
  return axios.post(
    '/api/admin/exam/check/image/export',
    {},
    { responseType: 'blob', params }
  );
}

// 开始图片检查
export function startImageCheck(): Promise<CheckRes> {
  return axios.post('/api/admin/exam/check/image/run', {});
}
// 图片检查状态
export function getImageCheckStatus(): Promise<boolean> {
  return axios.post('/api/admin/exam/check/image/status', {});
}

// 识别结果查询
export function getResultCheckDataList(
  params: ResultCheckDataListFilter
): Promise<number> {
  return axios.post('/api/admin/exam/check/answer/count', {}, { params });
}
