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

export const examStructureListPage = datas => {
  return $postParam("/api/admin/exam/structure/list", datas);
};
export const examStructureUpload = datas => {
  return $post("/api/admin/exam/structure/upload", datas);
};
export const examStructureUploadAnswer = datas => {
  return $post("/api/admin/exam/structure/upload_answer", datas);
};
export const examStructurePreviewStructure = id => {
  return $postParam("/api/admin/exam/structure/preview_structure", { id });
};
export const examStructureFindJpg = datas => {
  return $postParam("/api/admin/exam/structure/find_jpg_file", datas);
};
export const examStructureSubmit = datas => {
  return $post("/api/admin/exam/structure/submit", datas);
};
export const updateObjectiveAnswer = datas => {
  return $post("/api/admin/exam/structure/update_objective_answer", datas);
};
export const examBindMarkLeader = datas => {
  return $post("/api/admin/exam/structure/bind_mark_leader", datas);
};

// score-archive
export const scoreListPage = datas => {
  return $postParam("/api/admin/sync/score/list", datas);
};
export const scoreExport = datas => {
  return $postParam("/api/admin/sync/score/export", datas);
};
export const scoreSync = datas => {
  return $postParam("/api/admin/sync/score/sync", datas);
};
export const scorePreview = id => {
  return $postParam("/api/admin/sync/score/preview", { id });
};
export const scoreDownload = id => {
  return $postParam(
    "/api/admin/sync/score/download",
    { id },
    {
      responseType: "blob"
    }
  );
};
export const scoreBatchDownload = datas => {
  return $postParam("/api/admin/sync/score/batch_download", datas);
};
// 第三方登录ypt
export const userSysRoles = () => {
  return $post("/api/admin/common/get_open_role", {});
};
export const yptAuth = roleType => {
  if (roleType === "MARKER") {
    return $post("/api/admin/exam/sso/marker_login", {});
  } else {
    return $post("/api/admin/exam/sso/marker_leader_login", {});
  }
};
// sync-result-manage
export const syncResultListPage = datas => {
  return $postParam("/api/admin/data/sync/query", datas);
};
export const syncResync = id => {
  return $postParam("/api/admin/data/sync/resync", { id });
};
