import 'package:equatable/equatable.dart';
import 'package:smart_hotel_app/models/bo/room_bo.dart';

class RoomReportState extends Equatable {
  final bool isLoading;
  final String? error;
  final RoomOverviewSummaryBO summary;
  final List<RoomFloorBO> floors;
  final int selectedFloorIndex;
  final List<RoomGridBO> roomGrid;
  final List<RoomDetailListBO> detailRooms;

  const RoomReportState({
    this.isLoading = false,
    this.error,
    this.summary = const RoomOverviewSummaryBO(),
    this.floors = const [],
    this.selectedFloorIndex = 0,
    this.roomGrid = const [],
    this.detailRooms = const [],
  });

  RoomReportState copyWith({
    bool? isLoading,
    String? error,
    RoomOverviewSummaryBO? summary,
    List<RoomFloorBO>? floors,
    int? selectedFloorIndex,
    List<RoomGridBO>? roomGrid,
    List<RoomDetailListBO>? detailRooms,
    bool clearError = false,
  }) {
    return RoomReportState(
      isLoading: isLoading ?? this.isLoading,
      error: clearError ? null : (error ?? this.error),
      summary: summary ?? this.summary,
      floors: floors ?? this.floors,
      selectedFloorIndex: selectedFloorIndex ?? this.selectedFloorIndex,
      roomGrid: roomGrid ?? this.roomGrid,
      detailRooms: detailRooms ?? this.detailRooms,
    );
  }

  @override
  List<Object?> get props => [
        isLoading,
        error,
        summary,
        floors,
        selectedFloorIndex,
        roomGrid,
        detailRooms,
      ];
}
