import { defHttp } from '@/utils/http/axios';
enum Api {
  // 到期预警
  TimeoutWarning = '/api/DroneSsny/TimeoutWarning',
  // 超期预警
  TimeOutAlarmList = '/api/DroneSsny/TimeOutAlarmList',
  // 到期预警导出
  TimeoutWarningExport = '/api/DroneSsny/TimeoutWarningExport',
  // 超期预警导出
  TimeoutAlarmExport = '/api/DroneSsny/TimeoutAlarmExport',
  // 历史项目
  HistoryProject = '/api/DroneSsny/HistoryProject',
  // 历史项目导出
  HistoryProjectExport = '/api/DroneSsny/HistoryProjectExport',
  // 项目列表
  GetDronssnydList = '/api/DroneSsny/GetDronssnydList',
  // 项目变更
  ProjectChange = '/api/DroneSsny/ProjectChange',
  // 项目变更导出
  ProjectChangeExport = '/api/DroneSsny/ProjectChangeExport',
  // 项目维护
  ProjectMaintain = '/api/DroneSsny/ProjectMaintain',
  // 停止生产
  CloseProject = '/api/DroneSsny/CloseProject',
  // 项目续期
  ProjectRenewal = '/api/DroneSsny/ProjectRenewal',
  // 项目移交
  ProjectHandover = '/api/DroneSsny/ProjectHandover',
}

export function TimeoutWarning(params) {
  return defHttp.get({ url: Api.TimeoutWarning, params });
}
export function TimeOutAlarmList(params) {
  return defHttp.get({ url: Api.TimeOutAlarmList, params });
}
export function TimeoutWarningExport(params) {
  let paramsString = new URLSearchParams(params).toString();
  return defHttp.post({ 
    url: `${Api.TimeoutWarningExport}?${paramsString}`,
    params,
    responseType: 'blob',
  });
}
export function TimeoutAlarmExport(params) {
  let paramsString = new URLSearchParams(params).toString();
  return defHttp.post({ 
    url: `${Api.TimeoutAlarmExport}?${paramsString}`,
    params,
    responseType: 'blob',
  });
}
export function HistoryProject(params) {
  return defHttp.get({ url: Api.HistoryProject, params });
}
export function HistoryProjectExport(params) {
  return defHttp.get({ 
    url: Api.HistoryProjectExport,
    params,
    responseType: 'blob',
  });
}
export function GetDronssnydList(params) {
  return defHttp.get({ url: Api.GetDronssnydList, params });
}
export function ProjectChange(params) {
  return defHttp.get({ url: Api.ProjectChange, params });
}
export function ProjectChangeExport(params) {
  return defHttp.get({ 
    url: Api.ProjectChangeExport,
    params,
    responseType: 'blob',
  });
}
export function ProjectMaintain(params) {
  return defHttp.post({ url: Api.ProjectMaintain, params });
}
export function CloseProject(id) {
  return defHttp.post({
    url: `${Api.CloseProject}?id=${id}`
  });
}
export function ProjectRenewal(params: {id:string, newEndTime: string}) {
  return defHttp.post({
    url: `${Api.ProjectRenewal}?id=${params.id}&newEndTime=${params.newEndTime}`
  });
}
export function ProjectHandover(params) {
  return defHttp.post({ url: Api.ProjectHandover, params });
}