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 finishPrintPlan = (id) => {
  return $postParam("/api/admin/exam/print/plan_finish", { id });
};
export const printPlanTemplateList = (datas) => {
  return $postParam("/api/admin/exam/print/get_template", datas);
};
export const printPlanBkDetailListPage = (datas) => {
  return $postParam("/api/admin/exam/print/list_makeup_task", datas);
};
export const printPlanBkDetailUpdate = (datas) => {
  return $post("/api/admin/exam/print/save_makeup_task", 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 deleteBusinessData = (id) => {
  return $postParam("/api/admin/exam/print/data_delete", { id });
};
export const businessTemplateDownload = () => {
  return $postParam(
    "/api/admin/exam/print/template_download",
    {},
    { responseType: "blob" }
  );
};
export const planBatchLinkPaper = (datas) => {
  return $postParam("/api/admin/exam/print/relate_update_batch", datas);
};
export const planAllRelatePaperTypes = (datas) => {
  return $postParam("/api/admin/exam/print/list_relate_common_types", datas);
};
export const queryBusinessCoursePaperType = (datas) => {
  return $postParam("/api/admin/exam/print/list_exam_detail_course", datas);
};
export const businessAddStudent = (datas) => {
  return $post("/api/admin/exam/print/add_exam_student", datas);
};
export const businessDeleteStudent = (id) => {
  return $postParam("/api/admin/exam/print/delete_exam_student", { id });
};
// 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 planLinkPaperTotal = (datas) => {
  return $postParam("/api/admin/exam/print/relate_total", 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 batchCancelPrintTask = (ids, type) => {
  return $post("/api/admin/exam/print/task_batch_cancel", {
    ids,
    type,
  });
};
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 rebuildPrintTaskPdf = (idList, type) => {
  return $postParam("/api/admin/data/task/reset_create_pdf", { idList, type });
};
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 });
};
export const getPrintTaskWholePdf = (datas) => {
  // examId,courseId,paperNumber
  return $postParam("/api/admin/exam/print/get_whole_pdf", datas);
};
export const createPrintTaskWholePdf = (datas) => {
  // examId,courseId,paperNumber
  return $postParam("/api/admin/exam/print/create_whole_pdf", datas);
};
