// WFProcess 流程模版基本信息
import { defHttp } from '@/utils/http/axios';
import {
  taskCountParams,
  caseInfoParams,
  countModel,
  taskInfoParams,
  addCaseFavoriteParams,
  updateCaseInfoParams,
} from './model/index';

enum Api {
  // 获取待办任务统计数据
  LoadTaskCount = '/api/DroneCaseInfoZjgg/LoadTaskCount',
  // 获取线索信息统计数据
  LoadDroneCaseInfoCount = '/api/DroneCaseInfoZjgg/LoadDroneCaseInfoCount',
  // 分页获取线索信息列表
  LoadDroneCaseInfoDetail = '/api/DroneCaseInfoZjgg/LoadTasklList',
  // 分页获取任务信息列表
  LoadTaskDetailList = '/api/DroneCaseInfoZjgg/LoadTaskDetailList',
  // 收藏线索
  AddCaseFavorite = '/api/DroneCaseInfoZjgg/AddCaseFavorite',
  // 获取收藏线索列表
  FavoriteCaseList = '/api/DroneCaseInfoZjgg/FavoriteCaseList',
  DeleteFavoriteCase = '/api/DroneCaseInfoZjgg/DeleteFavoriteCase',
  // 获取线索列表
  LoadCaseInfoTuBanList = '/api/DroneCaseInfoZjgg/LoadCaseInfoTuBanList',
  // 获取线索详情
  GetCaseInfoById = '/api/DroneCaseInfoZjgg/GetCaseInfoById',
  // 更新线索行政区划
  UpdateDroneCaseInfo = '/api/DroneCaseInfoZjgg/UpdateDroneCaseInfo',
  // 督办流程
  Supervise = '/api/WFProcess/Supervise',
  // 获取部门父级
  LoadParents = '/api/Orgs/LoadParents',
  // 审核列表收藏
  AddtaskFavorite = '/api/DroneCaseInfoZjgg/AddtaskFavorite',
  // 审核列表删除收藏
  DeleteTaskCase = '/api/DroneCaseInfoZjgg/DeleteTaskCase',
  // 获取当前账号可以看见的乡镇
  loadStreet = '/api/DroneCaseInfoSingle/loadStreet',
  // 违法处理，待办任务列表
  LoadTaskIllegalDetailList = '/api/DroneCaseInfoZjgg/LoadTaskIllegalDetailList',
  // 分割线索
  SplitCase = '/api/DroneCaseInfoZjgg/CaseSplit',
  // 恢复还原
  RecoverCase = '/api/DroneCaseInfoZjgg/CaseRecover',
  // 获取线索中心点
  GetPolygonCenter = '/api/DroneCaseInfoZjgg/GetCenterPoints',
  // 获取用户访问机构权限
  GetUserOrgs = '/api/Check/GetOrgs',
  // 获取案件图片坐标、方位角信息
  LoadCaseImgList = '/api/DroneCaseInfoZjgg/LoadCaseImgList',
}

/**
 * @description: getCaseFlowLog
 */
export function getLoadTaskCount(params?: taskCountParams) {
  return defHttp.get<countModel>({ url: Api.LoadTaskCount, params });
}
export function getLoadStreet() {
  return defHttp.get({ url: Api.loadStreet });
}

/**
 * @description: getCaseFlowLog
 */
export function getLoadDroneCaseInfoCount(params?: taskCountParams) {
  return defHttp.get<countModel>({ url: Api.LoadDroneCaseInfoCount, params });
}

/**
 * @description: getCaseFlowLog
 */
export function getLoadDroneCaseInfoDetail(params?: caseInfoParams) {
  return defHttp.get({ url: Api.LoadDroneCaseInfoDetail, params });
}
/**
 * @description: getCaseFlowLog
 */
export function getLoadTaskDetailList(params?: taskInfoParams) {
  return defHttp.get({ url: Api.LoadTaskDetailList, params });
}

export function addCaseFavorite(params?: addCaseFavoriteParams) {
  return defHttp.post({ url: Api.AddCaseFavorite, params });
}
export function addTaskFavorite(params?: { taskId: string; favoriteUserId: string }) {
  return defHttp.post({ url: Api.AddtaskFavorite, params });
}
export function deleteFavoriteCase(params: string) {
  return defHttp.post({ url: Api.DeleteFavoriteCase, data: params });
}
export function deleteTaskCase(params: string) {
  return defHttp.post({ url: Api.DeleteTaskCase, data: params });
}

export function getFavoriteCaseList(params?: { uid: string }) {
  return defHttp.get({ url: Api.FavoriteCaseList, params });
}
export function loadCaseInfoTuBanList(params) {
  return defHttp.get({ url: Api.LoadCaseInfoTuBanList, params });
}
export function getRepairCaseInfoById(params?: { id: string }) {
  return defHttp.get({ url: Api.GetCaseInfoById, params });
}
export const updateDroneCaseInfo = (params: updateCaseInfoParams) =>
  defHttp.post({ url: Api.UpdateDroneCaseInfo, params });

export const updateSupervise = (params: { id: string; supervise: number }) =>
  defHttp.post({ url: `${Api.Supervise}?id=${params.id}&supervise=${params.supervise}`, params });

export const getLoadParents = (params: { childId: Number }) =>
  defHttp.get({ url: `${Api.LoadParents}?childId=${params.childId}` });

export function getLoadTaskIllegalDetailList(params?: taskInfoParams) {
  return defHttp.get({ url: Api.LoadTaskIllegalDetailList, params });
}

export function splitCase(params){
  return defHttp.post({ url: Api.SplitCase, data: params });
}

export function recoverCase(params){
  return defHttp.post({ url: Api.RecoverCase, data: params });
}

export function getPolygonCenter(params){
  return defHttp.get({ url: Api.GetPolygonCenter, params });
}

export function getUserOrgs(params){
  return defHttp.get({ url: Api.GetUserOrgs, params });
}

export function getLoadCaseImgList(params){
  return defHttp.get({
    url: Api.LoadCaseImgList,
    params,
  });
}