import request from '@/api/index'
enum api {
  // 上传
  upload = 'file/upload',
  // 采集参数
  collect = '/collectionConfig/listPage',
  collectAdd = '/collectionConfig/add',
  collectUpdate = '/collectionConfig/update',
  collectDelete = '/collectionConfig/delete',
  // 配电网列表
  electricity = 'carbonElectricity/listPage',
  electricitylist = '/carbonElectricity/list', // 不分页
  electricityAdd = 'carbonElectricity/add',
  electricityUpdate = 'carbonElectricity/update',
  electricityDelete = 'carbonElectricity/delete',
  // 光伏/楼宇/电动车管理列表
  monitorStation = '/monitorStation/listPage',
  monitorStationAdd = '/monitorStation/add',
  monitorStationUpdate = '/monitorStation/update',
  monitorStationdDelete = '/monitorStation/delete',
  // 设备管理列表
  device = '/carbonDevice/list',
  devicePage = '/carbonDevice/listPage',
  deviceAdd = '/carbonDevice/add',
  deviceUpdate = '/carbonDevice/update',
  deviceDelete = '/carbonDevice/delete',
  deviceDetail = '/carbonDevice/detail',
  // 环境参数
  environment = '/environmentInfo/listPage',
  environmentAdd = '/environmentInfo/add',
  environmentUpdate = '/environmentInfo/update',
  environmentDelete = '/environmentInfo/delete',
  // 用热监测/用气监测
  carbonOtherMonitorAdd = '/deviceCollectionLog/add',
  carbonOtherMonitorUpdate = '/deviceCollectionLog/update',
  carbonOtherMonitorDelete = '/deviceCollectionLog/delete',
  carbonOtherMonitor = '/deviceCollectionLog/listPage',
}
// 上传
export function uploadApi(data: FormData) {
  return request({
    url: `${api.upload}`,
    method: 'post',
    data,
  })
}
// 采集参数列表
export function getCollectList(params: any) {
  return request({
    url: `${api.collect}`,
    method: 'get',
    params,
  })
}
// 添加 采集参数
export function addCollectList(data: any) {
  return request({
    url: `${api.collectAdd}`,
    method: 'post',
    data,
  })
}
// 修改 采集参数
export function updateCollectList(data: any) {
  return request({
    url: `${api.collectUpdate}`,
    method: 'post',
    data,
  })
}
// 删除 采集参数
export function deleteCollectList(id: any) {
  return request({
    url: `${api.collectDelete}?id=${id}`,
    method: 'post',
  })
}
// 配电网列表
export function getElectricityList(params: any) {
  return request({
    url: `${api.electricity}`,
    method: 'get',
    params,
  })
}
export function getElectricityListAll() {
  return request({
    url: `${api.electricitylist}`,
    method: 'get',
  })
}
// 添加 配电网
export function addElectricityList(data: any) {
  return request({
    url: `${api.electricityAdd}`,
    method: 'post',
    data,
  })
}
// 修改 配电网
export function updateElectricityList(data: any) {
  return request({
    url: `${api.electricityUpdate}`,
    method: 'post',
    data,
  })
}
// 删除 配电网
export function deleteElectricityList(id: any) {
  return request({
    url: `${api.electricityDelete}?id=${id}`,
    method: 'post',
  })
}
// 配电网节点查询 / 母线参数
export function electricityNode(id: any) {
  return request({
    url: `/electricityNode/list?electricityId=${id}`,
    method: 'get',
  })
}
export function electricityNodePage(params: any) {
  return request({
    url: '/electricityNode/listPage',
    method: 'get',
    params,
  })
}
// 母线参数新增
export function electricityNodeAdd(data: object) {
  return request({
    url: '/electricityNode/add',
    method: 'post',
    data,
  })
}
// 母线参数修改
export function electricityNodeUpdate(data: object) {
  return request({
    url: '/electricityNode/update',
    method: 'post',
    data,
  })
}
// 母线参数删除
export function electricityNodeDelete(id: string) {
  return request({
    url: `/electricityNode/delete?id=${id}`,
    method: 'post',
  })
}
// 配电网支路查询
export function electricityBranch(id: any) {
  return request({
    url: `/branchNodeInfo/branchList?electricityId=${id}`,
    method: 'get',
  })
}
// 配电网支路查询 分页
export function electricityBranchPage(params: any) {
  return request({
    url: '/branchNodeInfo/listPage',
    method: 'get',
    params,
  })
}
// 配电网支路修改
export function electricityBranchUpdate(data: object) {
  return request({
    url: '/branchNodeInfo/update',
    method: 'post',
    data,
  })
}
// 配电网支路新增
export function electricityBranchAdd(data: object) {
  return request({
    url: '/branchNodeInfo/add',
    method: 'post',
    data,
  })
}
// 配电网支路删除
export function electricityBranchDel(id: string) {
  return request({
    url: `/branchNodeInfo/delete?id=${id}`,
    method: 'post',
  })
}
// 光伏/楼宇/电动车管理列表
export function getMonitorStation(params: any) {
  return request({
    url: `${api.monitorStation}`,
    method: 'get',
    params,
  })
}
// 光伏详情
export function getMonitorStationDetail(id: string) {
  return request({
    url: `/monitorStation/detail/${id}`,
    method: 'get',
  })
}
// 光伏列表 - 不分页
export function getMonitorStationList() {
  return request({
    url: '/monitorStation/list',
    method: 'get',
  })
}
// 添加 光伏/楼宇/电动车管
export function addMonitorStation(data: any) {
  return request({
    url: `${api.monitorStationAdd}`,
    method: 'post',
    data,
  })
}
// 修改 光伏/楼宇/电动车管
export function updateMonitorStation(data: any) {
  return request({
    url: `${api.monitorStationUpdate}`,
    method: 'post',
    data,
  })
}
// 删除 光伏/楼宇/电动车管
export function deleteMonitorStation(id: any) {
  return request({
    url: `${api.monitorStationdDelete}?id=${id}`,
    method: 'post',
  })
}
// 设备管理列表
export function getDeviceList(params: any) {
  return request({
    url: `${api.device}`,
    method: 'get',
    params,
  })
}
export function getDeviceListPage(params: any) {
  return request({
    url: `${api.devicePage}`,
    method: 'get',
    params,
  })
}
// 添加 设备管理
export function addDeviceList(data: any) {
  return request({
    url: `${api.deviceAdd}`,
    method: 'post',
    data,
  })
}
// 修改 设备管理
export function updateDeviceList(data: any) {
  return request({
    url: `${api.deviceUpdate}`,
    method: 'post',
    data,
  })
}
// 删除 设备管理
export function deleteDeviceList(id: any) {
  return request({
    url: `${api.deviceDelete}?id=${id}`,
    method: 'post',
  })
}
// 获取设备详情
export function getDeviceDetail(id: any) {
  return request({
    url: `${api.deviceDetail}?id=${id}`,
    method: 'get',
  })
}
// 设备监测趋势分析
export function getDeviceDetailAnalysis(params: object) {
  return request({
    url: '/deviceCollectionLog/detail-analysis',
    method: 'get',
    params,
  })
}
// 环境参数列表
export function getEnvironmentList(params: any) {
  return request({
    url: `${api.environment}`,
    method: 'get',
    params,
  })
}
// 修改 环境参数
export function updateEnvironmentList(data: any) {
  return request({
    url: `${api.environmentUpdate}`,
    method: 'post',
    data,
  })
}
// 增加 环境参数
export function addEnvironmentList(data: any) {
  return request({
    url: `${api.environmentAdd}`,
    method: 'post',
    data,
  })
}
// 删除 环境参数
export function deleteEnvironmentList(id: any) {
  return request({
    url: `${api.environmentDelete}?id=${id}`,
    method: 'post',
  })
}
// 用热监测/用气监测列表
export function getCarbonOtherMonitor(params: any) {
  return request({
    url: `${api.carbonOtherMonitor}`,
    method: 'get',
    params,
  })
}
// 增加 用热监测/用气监测
export function addCarbonOtherMonitor(data: any) {
  return request({
    url: `${api.carbonOtherMonitorAdd}`,
    method: 'post',
    data,
  })
}
// 修改 用热监测/用气监测
export function updateCarbonOtherMonitor(data: any) {
  return request({
    url: `${api.carbonOtherMonitorUpdate}`,
    method: 'post',
    data,
  })
}
// 删除 用热监测/用气监测
export function deleteCarbonOtherMonitor(id: any) {
  return request({
    url: `${api.carbonOtherMonitorDelete}?id=${id}`,
    method: 'post',
  })
}
// 获取区域点位信息
export function getAreaPosition(id: any) {
  return request({
    url: '/api/carbon/area',
    method: 'post',
    data: {
      params: [id],
    },
  })
}
