import 'package:equatable/equatable.dart';

class ReportIndexState extends Equatable {
  final bool isLoading;
  final String? error;
  final Map<String, dynamic> reportHeader;
  final Map<String, dynamic> reportMetrics;
  final Map<String, dynamic> weeklyPowerUsage;
  final Map<String, dynamic> roomStatusDistribution;
  final Map<String, dynamic> deviceOnlineRate;
  final Map<String, dynamic> quickActions;

  const ReportIndexState({
    this.isLoading = false,
    this.error,
    this.reportHeader = const {},
    this.reportMetrics = const {},
    this.weeklyPowerUsage = const {},
    this.roomStatusDistribution = const {},
    this.deviceOnlineRate = const {},
    this.quickActions = const {},
  });

  ReportIndexState copyWith({
    bool? isLoading,
    String? error,
    Map<String, dynamic>? reportHeader,
    Map<String, dynamic>? reportMetrics,
    Map<String, dynamic>? weeklyPowerUsage,
    Map<String, dynamic>? roomStatusDistribution,
    Map<String, dynamic>? deviceOnlineRate,
    Map<String, dynamic>? quickActions,
    bool clearError = false,
  }) {
    return ReportIndexState(
      isLoading: isLoading ?? this.isLoading,
      error: clearError ? null : (error ?? this.error),
      reportHeader: reportHeader ?? this.reportHeader,
      reportMetrics: reportMetrics ?? this.reportMetrics,
      weeklyPowerUsage: weeklyPowerUsage ?? this.weeklyPowerUsage,
      roomStatusDistribution: roomStatusDistribution ?? this.roomStatusDistribution,
      deviceOnlineRate: deviceOnlineRate ?? this.deviceOnlineRate,
      quickActions: quickActions ?? this.quickActions,
    );
  }

  @override
  List<Object?> get props => [
        isLoading,
        error,
        reportHeader,
        reportMetrics,
        weeklyPowerUsage,
        roomStatusDistribution,
        deviceOnlineRate,
        quickActions,
      ];
}
