import { get, post, upload, download } from '@/api/request';

const env = import.meta.env;
const PREFIX = env.VITE_API_PREFIX_TASK;

export const createTaskPoolApi = (params: any) => {
  return post(`${PREFIX}taskpool/createTaskPool`, params);
};

export const updateTaskPoolApi = (params: any) => {
  return post(`${PREFIX}taskpool/updateTaskPool`, params);
};

export const getAllTaskPoolApi = (params: any) => {
  return get(`${PREFIX}taskpool/getAllTaskPool`, params);
};

export const getTaskPoolVersionsApi = (params: any) => {
  return get(`${PREFIX}taskpool/getTaskPoolVersions`, params);
};

export const getTaskPoolApi = (params: any) => {
  return get(`${PREFIX}taskpool/getTaskPool`, params);
};

export const cleanTaskPoolApi = (params: any) => {
  return get(`${PREFIX}taskpool/cleanTaskPool`, params);
};

export const importTaskPoolApi = (params: any) => {
  return upload(`${PREFIX}taskpool/importTaskPool`, params);
};

export const exportTaskPoolApi = (params: any) => {
  return download(`${PREFIX}taskpool/exportTaskPool`, params);
};

export const getTaskPoolPerformanceWithVersionApi = (params: any) => {
  return get(`${PREFIX}taskpool/getTaskPoolPerformanceWithVersion`, params);
};

export const exportTaskPoolPerformanceApi = (params: any, filename: string) => {
  return download(`${PREFIX}taskPerformance/exportTaskPoolPerformance`, params, filename);
};

export const getTaskPerformanceApi = (params: any) => {
  return get(`${PREFIX}taskPerformance/getTaskPerformance`, params);
};

export const getTaskPoolLoadcasesApi = (params: any) => {
  return get(`${PREFIX}taskpool/getTaskPoolLoadcases`, params);
};

export const batchAddTaskPerformanceApi = (params: any) => {
  return post(`${PREFIX}taskPerformance/batchAddTaskPerformance`, params);
};

export const batchDeleteTaskPerformanceApi = (params: any) => {
  return post(`${PREFIX}taskPerformance/batchDeleteTaskPerformance`, params);
};

export const getRunPerformanceApi = (params: any) => {
  return get(`${PREFIX}taskPerformance/getRunPerformance`, params);
};

export const getAllTaskPoolCurrentVersionApi = (params: any) => {
  return get(`${PREFIX}taskpool/getAllTaskPoolCurrentVersion`, params);
};

export const statisticDisciplineDifficultyApi = (params: { poolName: string }) => {
  return get(`${PREFIX}taskpool/statisticDisciplineDifficulty`, params);
};

export const statisticDisciplineConfidenceApi = (params: { poolName: string }) => {
  return get(`${PREFIX}taskpool/statisticDisciplineConfidence`, params);
};

export const statisticDisciplineConfidenceTrendApi = (params: {
  poolName: string;
  timeRange: string;
}) => {
  return get(`${PREFIX}taskpool/statisticDisciplineConfidenceTrend`, params);
};

export const statisticWorkspaceConfidenceApi = (params: { poolName: string }) => {
  return get(`${PREFIX}taskpool/statisticWorkspaceConfidence`, params);
};

export const statisticMachineConfidenceApi = (params: { poolName: string }) => {
  return get(`${PREFIX}taskpool/statisticMachineConfidence`, params);
};
