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

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

/**
 *
 * @param type: 0 我执行的 1我关注的 2所有任务 3我负责的
 * @param sortOrder 0-按创建时间正序，1-倒序
 * @returns
 */
export const queryTaskListApi = (params: any) => {
  return post(`${PREFIX}task/list`, params);
};

export const updateTaskStatusApi = (params: any) => {
  return post(`${PREFIX}task/operation`, params);
};

export const attentionTaskApi = (params: any) => {
  return post(`${PREFIX}task/attention`, params);
};

export const editTaskApi = (params: any) => {
  return post(`${PREFIX}task/edit`, params);
};

export const getTaskCountApi = (params: any) => {
  return post(`${PREFIX}task/count`, params);
};

/**
 * 获取用户工作负载信息
 * @param params
 * @returns
 */
export const getListUserWorkloadsApi = (params: any) => {
  return post(`${PREFIX}task/listUserWorkloads`, params);
};

export const exportTaskApi = (params: any, filename:string) => {
  return download(`${PREFIX}task/exportTask`, params, filename);
};
// 获取任务详情（数据总览专用）
export const getTaskDetailApi = (params: any) => {
  return post(`${PREFIX}task/getTaskDetail`, params);
};
