import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';

class EquipmentItem {
  final IconData icon;
  final String title;
  final String subtitle;
  final String status;
  final Color statusColor;

  const EquipmentItem({
    required this.icon,
    required this.title,
    required this.subtitle,
    required this.status,
    required this.statusColor,
  });
}

class HomeIndexState extends Equatable {
  final int highAlarmCount;
  final int mediumAlarmCount;
  final int onlineDeviceCount;
  final String temperatureAlarmTitle;
  final String temperatureAlarmLocation;
  final String currentTemperature;
  final String currentVoltage;
  final String currentCurrent;
  final String waitTime;
  final String alarmLevel;
  final String voltageAlarmTitle;
  final String voltageAlarmLocation;
  final String voltageValue;
  final String normalVoltage;
  final String voltageWaitTime;
  final String voltageAlarmLevel;
  final List<EquipmentItem> equipmentList;

  const HomeIndexState({
    this.highAlarmCount = 0,
    this.mediumAlarmCount = 0,
    this.onlineDeviceCount = 0,
    this.temperatureAlarmTitle = '',
    this.temperatureAlarmLocation = '',
    this.currentTemperature = '',
    this.currentVoltage = '',
    this.currentCurrent = '',
    this.waitTime = '',
    this.alarmLevel = '',
    this.voltageAlarmTitle = '',
    this.voltageAlarmLocation = '',
    this.voltageValue = '',
    this.normalVoltage = '',
    this.voltageWaitTime = '',
    this.voltageAlarmLevel = '',
    this.equipmentList = const [],
  });

  HomeIndexState copyWith({
    int? highAlarmCount,
    int? mediumAlarmCount,
    int? onlineDeviceCount,
    String? temperatureAlarmTitle,
    String? temperatureAlarmLocation,
    String? currentTemperature,
    String? currentVoltage,
    String? currentCurrent,
    String? waitTime,
    String? alarmLevel,
    String? voltageAlarmTitle,
    String? voltageAlarmLocation,
    String? voltageValue,
    String? normalVoltage,
    String? voltageWaitTime,
    String? voltageAlarmLevel,
    List<EquipmentItem>? equipmentList,
  }) {
    return HomeIndexState(
      highAlarmCount: highAlarmCount ?? this.highAlarmCount,
      mediumAlarmCount: mediumAlarmCount ?? this.mediumAlarmCount,
      onlineDeviceCount: onlineDeviceCount ?? this.onlineDeviceCount,
      temperatureAlarmTitle: temperatureAlarmTitle ?? this.temperatureAlarmTitle,
      temperatureAlarmLocation: temperatureAlarmLocation ?? this.temperatureAlarmLocation,
      currentTemperature: currentTemperature ?? this.currentTemperature,
      currentVoltage: currentVoltage ?? this.currentVoltage,
      currentCurrent: currentCurrent ?? this.currentCurrent,
      waitTime: waitTime ?? this.waitTime,
      alarmLevel: alarmLevel ?? this.alarmLevel,
      voltageAlarmTitle: voltageAlarmTitle ?? this.voltageAlarmTitle,
      voltageAlarmLocation: voltageAlarmLocation ?? this.voltageAlarmLocation,
      voltageValue: voltageValue ?? this.voltageValue,
      normalVoltage: normalVoltage ?? this.normalVoltage,
      voltageWaitTime: voltageWaitTime ?? this.voltageWaitTime,
      voltageAlarmLevel: voltageAlarmLevel ?? this.voltageAlarmLevel,
      equipmentList: equipmentList ?? this.equipmentList,
    );
  }

  @override
  List<Object?> get props => [
        highAlarmCount,
        mediumAlarmCount,
        onlineDeviceCount,
        temperatureAlarmTitle,
        temperatureAlarmLocation,
        currentTemperature,
        currentVoltage,
        currentCurrent,
        waitTime,
        alarmLevel,
        voltageAlarmTitle,
        voltageAlarmLocation,
        voltageValue,
        normalVoltage,
        voltageWaitTime,
        voltageAlarmLevel,
        equipmentList,
      ];
}