import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:smart_hotel_app/models/bo/alert_dashboard_bo.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 {
  static const _nothing = Object();

  final bool isLoading;
  final bool isHandlingAlert;
  final String? error;
  final int highAlarmCount;
  final int mediumAlarmCount;
  final int onlineDeviceCount;
  final List<AlertItemBO> alerts;
  final List<EquipmentItem> equipmentList;

  const HomeIndexState({
    this.isLoading = false,
    this.isHandlingAlert = false,
    this.error,
    this.highAlarmCount = 0,
    this.mediumAlarmCount = 0,
    this.onlineDeviceCount = 0,
    this.alerts = const [],
    this.equipmentList = const [],
  });

  HomeIndexState copyWith({
    bool? isLoading,
    bool? isHandlingAlert,
    Object? error = _nothing,
    int? highAlarmCount,
    int? mediumAlarmCount,
    int? onlineDeviceCount,
    List<AlertItemBO>? alerts,
    List<EquipmentItem>? equipmentList,
  }) {
    return HomeIndexState(
      isLoading: isLoading ?? this.isLoading,
      isHandlingAlert: isHandlingAlert ?? this.isHandlingAlert,
      error: identical(error, _nothing) ? this.error : error as String?,
      highAlarmCount: highAlarmCount ?? this.highAlarmCount,
      mediumAlarmCount: mediumAlarmCount ?? this.mediumAlarmCount,
      onlineDeviceCount: onlineDeviceCount ?? this.onlineDeviceCount,
      alerts: alerts ?? this.alerts,
      equipmentList: equipmentList ?? this.equipmentList,
    );
  }

  @override
  List<Object?> get props => [
        isLoading,
        isHandlingAlert,
        error,
        highAlarmCount,
        mediumAlarmCount,
        onlineDeviceCount,
        alerts,
        equipmentList,
      ];
}