import request from '@/config/axios'

export interface ElectricityConsumptionChartData {
  date: string
  value: number
}

export interface ElectricityConsumptionHistoryData {
  updateTime: string
  deviceName: string
  location: string
  currentKWh: number | string
  lastKWh: number | string
}

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

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