import { $httpWithMsg } from "../../plugins/axios";
import { QUESTION_API } from "@/constants/constants.js";

// paper-template-mamage
export const paperTemplatePageListApi = (datas) => {
  return $httpWithMsg.post(
    `${QUESTION_API}/paper_template/page`,
    {},
    { params: datas }
  );
};
export const paperTemplateListApi = (exportTemplateType) => {
  return $httpWithMsg.post(
    `${QUESTION_API}/paper_template/list`,
    {},
    {
      params: { exportTemplateType },
    }
  );
};
export const paperTemplateDetailApi = (tid) => {
  return $httpWithMsg.post(
    `${QUESTION_API}/paper_template/find_by_id`,
    {},
    {
      params: { id: tid },
    }
  );
};

export const savePaperTemplateApi = (datas) => {
  return $httpWithMsg.post(QUESTION_API + "/paper_template/save", datas);
};
export const paperTemplateEnableApi = ({ id, enable }) => {
  return $httpWithMsg.post(
    QUESTION_API + "/paper_template/enable",
    {},
    {
      params: { id, enable },
    }
  );
};
export const paperTemplateDeleteApi = (ids) => {
  return $httpWithMsg.post(
    QUESTION_API + "/paper_template/delete",
    {},
    {
      params: { idList: ids.join() },
    }
  );
};
export const paperPdfDownloadApi = (datas) => {
  return $httpWithMsg.post(QUESTION_API + "/paper/download_pdf", datas, {
    responseType: "blob",
  });
};
