import { defHttp } from '@/utils/http/axios';
import { TaskResultModel, AccountListItem, AccountParams, Task } from './model/index';

enum Api {
  // 管理员任务
  TaskList = "/api/AdminTaskManage/GteTaskListForAdmin",
  AddTask = "/api/AdminTaskManage/AddTask",
  EditTask = "/api/AdminTaskManage/EditTask",
  DeleteTask = "/api/AdminTaskManage/DeleteTask",
  DetailTask = "/api/AdminTaskManage/GteTaskById",
  GetAiShp = "/api/AdminTaskManage/GteAiShp",
  GetTif = "/api/AdminTaskManage/GteTif",
  // 普通用户任务
  PersonTaskList = "/api/PersonTask/Load",
  PersonTaskDetail = "/api/PersonTask/GetTaskDetail",
  SubmitPersonTask = "/api/PersonTask/SubmitTask",
  ReturnPersonTask = "/api/PersonTask/ReturnTask"
}

// 管理员任务
export const getTaskList = (params) =>
  defHttp.get<TaskResultModel>({ url: Api.TaskList, params });

export const addTask = (params:Task) =>
  defHttp.post<TaskResultModel>({ url: Api.AddTask, params });

export const updateTask = (params:Task) =>
  defHttp.post<TaskResultModel>({ url: Api.EditTask, params });

export const deleteTask = (params) =>
  defHttp.post<TaskResultModel>({ url: Api.DeleteTask, params });

export const getTaskDetail = (params) =>
  defHttp.get<TaskResultModel>({ url: Api.DetailTask, params });

export const getAiShape = () =>
  defHttp.get<TaskResultModel>({ url: Api.GetAiShp });

export const getTif = () =>
  defHttp.get<TaskResultModel>({ url: Api.GetTif });

// 普通用户任务
export const getPersonTaskList = (params) =>
  defHttp.get<TaskResultModel>({ url: Api.PersonTaskList, params });

export const getPersonTaskDetail = (params) =>
  defHttp.get<TaskResultModel>({ url: Api.PersonTaskDetail, params });

export const CommitTask = (params) =>
  defHttp.post<TaskResultModel>({ url: Api.SubmitPersonTask, params });


