part of 'reminder_defaults_cubit.dart';

enum ReminderDefaultsStatus { initial, loading, success, failure }

class ReminderDefaultsState extends Equatable {
  final ReminderDefaultsStatus status;
  final List<ReminderDefaultModel> reminders;
  final String? errorMessage;

  const ReminderDefaultsState({
    this.status = ReminderDefaultsStatus.initial,
    this.reminders = const [],
    this.errorMessage,
  });

  ReminderDefaultsState copyWith({
    ReminderDefaultsStatus? status,
    List<ReminderDefaultModel>? reminders,
    String? errorMessage,
  }) {
    return ReminderDefaultsState(
      status: status ?? this.status,
      reminders: reminders ?? this.reminders,
      // Se passiamo un nuovo status di successo o loading, puliamo l'errore
      errorMessage:
          errorMessage ??
          (status != ReminderDefaultsStatus.failure ? null : this.errorMessage),
    );
  }

  @override
  List<Object?> get props => [status, reminders, errorMessage];
}
