import 'package:equatable/equatable.dart';

class ZoneData {
  final String name;
  final double percentage;
  final double energy;

  const ZoneData({
    required this.name,
    required this.percentage,
    required this.energy,
  });
}

class EnergyState extends Equatable {
  final double todayEnergy;
  final double todayEnergyChange;
  final double monthEnergy;
  final double monthEnergyChange;
  final double monthBill;
  final List<double> hourlyData;
  final List<ZoneData> zoneData;

  const EnergyState({
    this.todayEnergy = 1284,
    this.todayEnergyChange = -8,
    this.monthEnergy = 38420,
    this.monthEnergyChange = -5,
    this.monthBill = 6982,
    this.hourlyData = const [
      45, 38, 32, 28, 25, 30, 42, 78, 112, 145, 168, 175,
      162, 148, 132, 115, 98, 82, 70, 58, 48, 42, 38, 35,
    ],
    this.zoneData = const [
      ZoneData(name: '客房区域', percentage: 68, energy: 873),
      ZoneData(name: '公共区域', percentage: 18, energy: 231),
      ZoneData(name: '餐饮区域', percentage: 10, energy: 128),
      ZoneData(name: '其他', percentage: 4, energy: 52),
    ],
  });

  EnergyState copyWith({
    double? todayEnergy,
    double? todayEnergyChange,
    double? monthEnergy,
    double? monthEnergyChange,
    double? monthBill,
    List<double>? hourlyData,
    List<ZoneData>? zoneData,
  }) {
    return EnergyState(
      todayEnergy: todayEnergy ?? this.todayEnergy,
      todayEnergyChange: todayEnergyChange ?? this.todayEnergyChange,
      monthEnergy: monthEnergy ?? this.monthEnergy,
      monthEnergyChange: monthEnergyChange ?? this.monthEnergyChange,
      monthBill: monthBill ?? this.monthBill,
      hourlyData: hourlyData ?? this.hourlyData,
      zoneData: zoneData ?? this.zoneData,
    );
  }

  @override
  List<Object?> get props => [
        todayEnergy,
        todayEnergyChange,
        monthEnergy,
        monthEnergyChange,
        monthBill,
        hourlyData,
        zoneData,
      ];
}