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

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

export const getTaskListApi = (params: any) => {
  return get(`${PREFIX}analysis/taskList`, params);
};

export const getPerformanceListApi = (params: any) => {
  return get(`${PREFIX}analysis/performanceList`, params);
};

export const getRunListApi = (params: any) => {
  return get(`${PREFIX}analysis/runList`, params);
};

/**
 * 获取任务下的算例指标信息
 * @param params taskId
 * @returns
 */
export const getAllRunResultByTaskIdApi = (params: any) => {
  return get(`${PREFIX}analysis/getAllRunResultByTaskId`, params);
};

export const exportTaskByScriptApi = (params: any, filename: string) => {
  return download(`${PREFIX}analysis/exportTaskByScript`, params, filename);
};

export const exportRunByScriptApi = (params: any, filename: string) => {
  return download(`${PREFIX}analysis/exportRunByScript`, params, filename);
};

export const exportPerformanceByScriptApi = (params: any, filename: string) => {
  return download(`${PREFIX}analysis/exportPerformanceByScript`, params, filename);
};
