import { $postParam, $post } from "@/plugins/axios";

// other
// 印刷计划模糊查询
export const printPlanQuery = param => {
  return $postParam("/api/admin/exam/print/query", { param });
};
// 考点模糊查询
export const placeQuery = datas => {
  return $postParam("/api/admin/exam/print/data_place_query", datas);
};
// 考场模糊查询
export const roomQuery = datas => {
  return $postParam("/api/admin/exam/print/data_room_query", datas);
};

// print-plan
export const printPlanListPage = datas => {
  return $postParam("/api/admin/exam/print/list", datas);
};
export const updatePrintPlan = datas => {
  return $post("/api/admin/exam/print/save", datas);
};
export const removePrintPlan = id => {
  return $post("/api/admin/exam/print/remove", { id });
};
export const printPlanTemplateList = datas => {
  return $postParam("/api/admin/exam/print/get_template", datas);
};
// business-data-export
export const businessDataListPage = datas => {
  return $postParam("/api/admin/exam/print/data_list", datas);
};
export const businessTotalData = datas => {
  return $postParam("/api/admin/exam/print/data_total", datas);
};
export const businessDataExport = datas => {
  return $postParam("/api/admin/exam/print/data_export", datas);
};
export const businessTemplateDownload = () => {
  return $postParam(
    "/api/admin/exam/print/template_download",
    {},
    { responseType: "blob" }
  );
};

// business-data-detail
export const businessDataDetailListPage = datas => {
  return $postParam("/api/admin/exam/print/data_detail", datas);
};
// 通过 examDetailId 查询考务明细记录
export const businessDataDetailListPageById = datas => {
  return $postParam("/api/admin/exam/print/data_detail_list", datas);
};
export const businessStudentDetail = id => {
  return $postParam("/api/admin/exam/print/get_student_detail", { id });
};

// plan-link-paper
export const planLinkPaperListPage = datas => {
  return $postParam("/api/admin/exam/print/relate_list", datas);
};
export const updatePlanLinkPaper = datas => {
  return $post("/api/admin/exam/print/relate_update", datas);
};
export const linkPaperNumberList = datas => {
  return $postParam("/api/admin/exam/print/relate_get_paper_numbers", datas);
};

// print-task-manage
export const printTaskListPage = datas => {
  return $postParam("/api/admin/exam/print/task_list", datas);
};
export const submitPrintTask = id => {
  return $post("/api/admin/exam/print/task_submit", { id, status: "WAITING" });
};
export const resubmitPrintTask = ({ id, printPlanId }) => {
  return $post("/api/admin/exam/print/task_resubmit", {
    id,
    printPlanId
  });
};
export const cancelPrintTask = id => {
  return $post("/api/admin/exam/print/task_cancel", { id, status: "READY" });
};
export const printTaskTotalInfo = datas => {
  return $postParam("/api/admin/exam/print/task_total_data", datas);
};
export const getPrintTaskPdf = examDetailId => {
  return $post("/api/admin/exam/print/task_view_pdf", { examDetailId });
};
export const downloadPrintTaskPdf = ids => {
  return $post("/api/admin/exam/print/task_download_pdf", { ids });
};
export const printTaskTemplateView = printPlanId => {
  return $post("/api/admin/exam/print/template_view", { printPlanId });
};
export const printTaskNormal = ({ id, normal }) => {
  return $post("/api/admin/exam/print/task_normal", { id, normal });
};
