import request from '@/config/axios'

export interface CoalMonitoringVO {
  id: number
  deviceCode: string
  deviceName: string
  location: string
  currentConsumption: number
  lastConsumption: number
  lastRecordTime: Date
  coalType: string
  status: 'online' | 'offline' | 'maintenance'
  remark: string
  text1: string
  text2: string
  text3: string
  createTime: Date
  updateTime: Date
  creator: string
  updater: string
  deleted: boolean
  tenantId: number
}

export interface CoalMonitoringPageReqVO extends PageParam {
  deviceCode?: string
  deviceName?: string
  location?: string
  coalType?: string
  status?: 'online' | 'offline' | 'maintenance'
  createTime?: Date[]
}

export interface CoalMonitoringExcelReqVO {
  deviceCode?: string
  deviceName?: string
  location?: string
  coalType?: string
  status?: 'online' | 'offline' | 'maintenance'
  createTime?: Date[]
}

// 查询煤炭监测列表
export const getCoalMonitoringPage = (params: CoalMonitoringPageReqVO) => {
  return request.get({ url: '/energy/coal-monitoring/page', params })
}

// 查询煤炭监测详情
export const getCoalMonitoring = (id: number) => {
  return request.get({ url: `/energy/coal-monitoring/get?id=${id}` })
}

// 新增煤炭监测
export const createCoalMonitoring = (data: CoalMonitoringVO) => {
  return request.post({ url: '/energy/coal-monitoring/create', data })
}

// 修改煤炭监测
export const updateCoalMonitoring = (data: CoalMonitoringVO) => {
  return request.put({ url: '/energy/coal-monitoring/update', data })
}

// 删除煤炭监测
export const deleteCoalMonitoring = (id: number) => {
  return request.delete({ url: `/energy/coal-monitoring/delete?id=${id}` })
}

// 导出煤炭监测 Excel
export const exportCoalMonitoring = (params: CoalMonitoringExcelReqVO) => {
  return request.download({ url: '/energy/coal-monitoring/export-excel', params })
}
