part of 'shifts_bloc.dart';

@immutable
sealed class ShiftsState extends Equatable {
  const ShiftsState();
  
  @override
  List<Object> get props => [];
}

class ShiftsInitial extends ShiftsState {}

class ShiftsLoading extends ShiftsState {}

class ShiftsLoaded extends ShiftsState {
  final List<Shift> myShifts;
  final List<Shift> pendingShifts;
  final List<Shift> cancelledShifts;
  final List<Shift> availableShifts;
  final List<Shift> historyShifts;
  final bool availableLoading;
  final bool availableLoaded;
  final bool historyLoading;
  final bool historyLoaded;
  final bool myShiftsLoaded;
  final String searchQuery;
  final String jobType;

  const ShiftsLoaded({
    required this.myShifts,
    required this.pendingShifts,
    required this.cancelledShifts,
    required this.availableShifts,
    required this.historyShifts,
    required this.availableLoading,
    required this.availableLoaded,
    required this.historyLoading,
    required this.historyLoaded,
    required this.myShiftsLoaded,
    required this.searchQuery,
    required this.jobType,
  });

  ShiftsLoaded copyWith({
    List<Shift>? myShifts,
    List<Shift>? pendingShifts,
    List<Shift>? cancelledShifts,
    List<Shift>? availableShifts,
    List<Shift>? historyShifts,
    bool? availableLoading,
    bool? availableLoaded,
    bool? historyLoading,
    bool? historyLoaded,
    bool? myShiftsLoaded,
    String? searchQuery,
    String? jobType,
  }) {
    return ShiftsLoaded(
      myShifts: myShifts ?? this.myShifts,
      pendingShifts: pendingShifts ?? this.pendingShifts,
      cancelledShifts: cancelledShifts ?? this.cancelledShifts,
      availableShifts: availableShifts ?? this.availableShifts,
      historyShifts: historyShifts ?? this.historyShifts,
      availableLoading: availableLoading ?? this.availableLoading,
      availableLoaded: availableLoaded ?? this.availableLoaded,
      historyLoading: historyLoading ?? this.historyLoading,
      historyLoaded: historyLoaded ?? this.historyLoaded,
      myShiftsLoaded: myShiftsLoaded ?? this.myShiftsLoaded,
      searchQuery: searchQuery ?? this.searchQuery,
      jobType: jobType ?? this.jobType,
    );
  }

  @override
  List<Object> get props => [
        myShifts,
        pendingShifts,
        cancelledShifts,
        availableShifts,
        historyShifts,
        availableLoading,
        availableLoaded,
        historyLoading,
        historyLoaded,
        myShiftsLoaded,
        searchQuery,
        jobType,
      ];
}

class ShiftsError extends ShiftsState {
  final String message;

  const ShiftsError(this.message);

  @override
  List<Object> get props => [message];
}
