import request from '@/config/axios'

// 水表监测类型定义
export interface WaterMonitoring {
  id?: number | string
  deviceCode: string
  deviceName: string
  location?: string
  currentValue: number
  lValue?: number
  lTime?: string
  status: 'online' | 'offline' | 'maintenance'
  remark?: string
  createTime?: string
  updateTime?: string
  creator?: string
  updater?: string
  deleted?: boolean
  tenantId?: number
}

// 分页查询参数
export enum WaterMonitoringStatus {
  Online = 'online',
  Offline = 'offline',
  Maintenance = 'maintenance',
}

export interface WaterMonitoringPageParams {
  pageNo: number
  pageSize: number
  deviceCode?: string
  deviceName?: string
  location?: string
  status?: WaterMonitoringStatus | string
}

// 分页查询
export const getWaterMonitoringPage = (params: WaterMonitoringPageParams) => {
  return request.get({ url: '/energy/water-monitoring/page', params })
}

// 新增水表监测
export const createWaterMonitoring = (data: WaterMonitoring) => {
  return request.post({ url: '/energy/water-monitoring/create', data })
}

// 更新水表监测
export const updateWaterMonitoring = (data: WaterMonitoring) => {
  return request.put({ url: '/energy/water-monitoring/update', data })
}

// 删除水表监测
export const deleteWaterMonitoring = (id: number | string) => {
  return request.delete({ url: `/energy/water-monitoring/delete?id=${id}` })
}

// 获取水表监测详情
export const getWaterMonitoring = (id: number | string) => {
  return request.get({ url: `/energy/water-monitoring/get?id=${id}` })
} 