import { request } from "@/utils/request";
import { ExamParams, RequestActionResult } from "./types/common";
import { ExamOverviewResult, AuditBatchResult } from "./types/audit";

export const examOverview = (data: ExamParams): Promise<ExamOverviewResult> =>
  request({
    url: "/api/auditor/exam/overview",
    method: "post",
    data,
  });

// 实时审核任务
export const intimeAuditBatch = (data: ExamParams): Promise<AuditBatchResult> =>
  request({
    url: "/api/auditor/batch/verify/get",
    method: "post",
    data,
  });

// 实时审核任务提交
export const intimeAuditBatchSubmit = (data: {
  batchId: number;
  confirm: boolean;
}): Promise<RequestActionResult> =>
  request({
    url: "/api/auditor/batch/verify/submit",
    method: "post",
    data,
  });

// 批次实时审核任务释放
export const intimeAuditBatchRelease = (
  data: ExamParams
): Promise<{ success: boolean }> =>
  request({
    url: "/api/auditor/batch/verify/release",
    method: "post",
    data,
  });

// 图片抽查
// 获取批次图片抽查任务
export const imageAuditBatch = (data: ExamParams): Promise<AuditBatchResult> =>
  request({
    url: "/api/auditor/batch/inspect/get",
    method: "post",
    data,
  });

// 批次图片抽查任务提交
export const imageAuditSave = (data: {
  examId: number;
  batchId: number;
}): Promise<RequestActionResult> =>
  request({
    url: "/api/auditor/batch/inspect/submit",
    method: "post",
    data,
  });

// 批次图片抽查任务释放
export const imageAuditRelease = (
  data: ExamParams
): Promise<RequestActionResult> =>
  request({
    url: "/api/auditor/batch/inspect/release",
    method: "post",
    data,
  });
