import { request } from "@/utils/request";

import {
  DataCheckListFilter,
  DataCheckListParams,
  DataCheckListResult,
  DataCheckOmrFieldEditParams,
  DataCheckOmrEditParams,
} from "./types/dataCheck";
import { RequestActionResult } from "./types/common";

// 图片检查
// 查询答题卡扫描详情
export const dataCheckList = (
  data: DataCheckListParams
): Promise<DataCheckListResult> =>
  request({
    url: "/api/admin/scan/answer/query",
    method: "post",
    data,
  });

// 按考生导出答题卡扫描详情
export const dataCheckStudentExport = (
  data: DataCheckListFilter
): Promise<AxiosResponse<Blob>> =>
  request({
    url: "/api/admin/scan/answer/student/export",
    method: "post",
    data,
    download: true,
  });

// 按考场导出答题卡扫描详情
export const dataCheckRoomExport = (
  data: DataCheckListFilter
): Promise<AxiosResponse<Blob>> =>
  request({
    url: "/api/admin/scan/answer/exam-room/export",
    method: "post",
    data,
    download: true,
  });

// 按类型修改卷型、识别结果等
export const dataCheckOmrFieldEdit = (
  data: DataCheckOmrFieldEditParams
): Promise<RequestActionResult> =>
  request({
    url: "/api/admin/scan/answer/omr/field/edit",
    method: "post",
    data,
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });

// 修改答题卡识别结果
export const dataCheckOmrEdit = (
  data: DataCheckOmrEditParams
): Promise<RequestActionResult> =>
  request({
    url: "/api/admin/scan/answer/omr/edit",
    method: "post",
    data,
  });
