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

enum Api {
  // 获取待办任务统计数据
  LoadTaskCount = '/api/DroneCaseInfoSingle/LoadTaskCount',
  //   获取图斑信息统计数据
  LoadDroneCaseInfoCount = '/api/DroneCaseInfoSingle/LoadDroneCaseInfoCount',
  // 分页获取图斑信息列表
  LoadDroneCaseInfoDetail = '/api/DroneCaseInfoSingle/LoadTasklList',
  // 分页获取任务信息列表
  LoadTaskDetailList = '/api/DroneCaseInfoSingle/LoadTaskDetailList',
  // 收藏图斑
  AddCaseFavorite = '/api/DroneCaseInfoSingle/AddCaseFavorite',
  // 获取收藏图斑列表
  FavoriteCaseList = '/api/DroneCaseinfo/FavoriteCaseList',
  DeleteFavoriteCase = '/api/DroneCaseInfoSingle/DeleteFavoriteCase',
  // 获取图斑详情
  GetCaseInfoById = '/api/DroneCaseInfoSingle/GetCaseInfoById',
  // 更新图斑行政区划
  UpdateDroneCaseInfo = '/api/DroneCaseInfoSingle/UpdateDroneCaseInfo',
  // 督办流程
  Supervise = '/api/WFProcess/Supervise',
  // 获取部门父级
  LoadParents = '/api/Orgs/LoadParents',
  // 审核列表收藏
  AddtaskFavorite = '/api/DroneCaseInfoSingle/AddtaskFavorite',
  // 审核列表删除收藏
  DeleteTaskCase = '/api/DroneCaseInfoSingle/DeleteTaskCase',
  // 获取当前账号可以看见的乡镇
  loadStreet = '/api/DroneCaseInfoSingle/loadStreet',
  // 违法处理，待办任务列表
  LoadTaskIllegalDetailList = '/api/DroneCaseInfoSingle/LoadTaskIllegalDetailList',
  // 分割图斑
  SplitCase = '/api/DroneCaseInfoSingle/CaseSplit',
  // 恢复还原
  RecoverCase = '/api/DroneCaseInfoSingle/CaseRecover',
  // 获取图斑中心点
  GetPolygonCenter = '/api/DroneCaseInfoSingle/GetCenterPoints',
  // 获取用户访问机构权限
  GetUserOrgs = '/api/Check/GetOrgs',
  // 大屏下发图斑统计
  IssuedStatitical = '/api/DroneScreenDisplay/CaseOffenceXiaFa',
  // 大屏核实新增统计
  VerifyStatitical = '/api/DroneScreenDisplay/CaseOffenceCheckAdd',
  // 大屏整改剩余统计
  RectificationStatitical = '/api/DroneScreenDisplay/CaseOffenceModifyRemain',
  // 获取案件图片坐标、方位角信息
  LoadCaseImgList = '/api/DroneCaseInfoSingle/LoadCaseImgList',
  // 获取范围内影像服务信息
  GetIntersects = '/api/GeoTiffManager/GetIntersects',
  // 获取网络环境
  GetNetWorkEev = '/api/DroneCloudQuery/IsPublic',
  // 获取其他专题或历史图斑图片
  rebackzhuantipic = '/api/DroneCaseInfoSingle/rebackzhuantipic',
  CopyImg = '/api/DroneCaseInfoSingle/CopyImg',
  // 获取其他专题或历史图斑附件
  rebackzhuantifujian = '/api/DroneCaseInfoSingle/rebackzhuantifujian',
  Copyfujian = '/api/DroneCaseInfoSingle/Copyfujian',
}

/**
 * @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 getCaseInfoById(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 getIssuedStatitical(params) {
  return defHttp.get({
    url: Api.IssuedStatitical,
    params,
  });
}

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

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

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

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

export function getNetworkType() {
  return defHttp.get({ url: Api.GetNetWorkEev });
}
export function rebackzhuantipic(params: { zhuanti; CaseId }) {
  return defHttp.get({
    url: Api.rebackzhuantipic,
    params,
  });
}
export function CopyImg(params: { caseid; images }) {
  return defHttp.post({
    url: Api.CopyImg,
    data: params,
  });
}
export function rebackzhuantifujian(params: { zhuanti; CaseId }) {
  return defHttp.get({
    url: Api.rebackzhuantifujian,
    params,
  });
}
export function Copyfujian(params: string[]) {
  return defHttp.post({
    url: Api.Copyfujian,
    data: params,
  });
}
