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

import {
  ExamParams,
  ExamSubjectParams,
  RequestActionResult,
} from "./types/common";
import {
  ReviewTaskListItem,
  ReviewProgressResult,
  ReviewTaskSaveParams,
  ReviewTaskHistoryResult,
  ReviewWarningTaskExportParams,
} from "./types/review";

// 复核任务
export const reviewTaskList = (
  data: ExamSubjectParams
): Promise<ReviewTaskListItem[]> =>
  request({
    url: "/api/admin/check/inspect/task/get",
    method: "post",
    data,
  });

// 复核校验进度状态
export const reviewProgress = (
  data: ExamSubjectParams
): Promise<ReviewProgressResult> =>
  request({
    url: "/api/admin/check/omr/arbitrate/get",
    method: "post",
    data,
  });

// 复核校验任务历史
export const reviewTaskHistory = (
  data: ExamParams
): Promise<ReviewTaskHistoryResult> =>
  request({
    url: "/api/admin/check/omr/arbitrate/history",
    method: "post",
    data,
  });

// 复核校验结果提交
export const reviewTaskSave = (
  data: ReviewTaskSaveParams
): Promise<RequestActionResult> =>
  request({
    url: "/api/admin/check/omr/arbitrate/save",
    method: "post",
    data,
  });

// 复核校验重置
export const reviewTaskReset = (
  data: ExamSubjectParams
): Promise<RequestActionResult> =>
  request({
    url: "/api/admin/check/assigned/reset",
    method: "post",
    data,
  });

// 复核校验异常导出
export const reviewWarningTaskExport = (
  data: ReviewWarningTaskExportParams
): Promise<AxiosResponse<Blob>> =>
  request({
    url: "/api/admin/check/assigned/export",
    method: "post",
    data,
    download: true,
  });
