import request from '@/config/axios'

export interface WaterConsumptionChartData {
  date: string
  value: number
}

export interface WaterConsumptionHistoryData {
  updateTime: string
  deviceName: string
  location: string
  currentValue: number
  lastTonnage: number
}

// 获取用水量折线图数据
export const getWaterConsumptionChart = (params: { type: 'week' | 'month' | 'year' }) => {
  return request.get<WaterConsumptionChartData[]>({ 
    url: '/energy/water-consumption/chart', 
    params 
  })
}

// 获取用水量历史记录表格数据
export const getWaterConsumptionHistory = () => {
  return request.get<WaterConsumptionHistoryData[]>({ 
    url: '/energy/water-consumption/history' 
  })
}
