import 'package:equatable/equatable.dart';
import 'package:krow_domain/krow_domain.dart';

/// Represents the various states of the profile feature.
enum ProfileStatus {
  /// Initial state before any data is loaded
  initial,
  
  /// Profile data is being loaded
  loading,
  
  /// Profile data loaded successfully
  loaded,
  
  /// User successfully signed out
  signedOut,
  
  /// An error occurred while loading profile data
  error,
}

/// State class for the Profile feature.
///
/// Contains the current profile data and loading status.
/// Uses the [Staff] entity directly from domain layer.
class ProfileState extends Equatable {
  /// Current status of the profile feature
  final ProfileStatus status;
  
  /// The staff member's profile object (null if not loaded)
  final Staff? profile;
  
  /// Error message if status is error
  final String? errorMessage;

  const ProfileState({
    this.status = ProfileStatus.initial,
    this.profile,
    this.errorMessage,
  });

  /// Creates a copy of this state with updated values.
  ProfileState copyWith({
    ProfileStatus? status,
    Staff? profile,
    String? errorMessage,
  }) {
    return ProfileState(
      status: status ?? this.status,
      profile: profile ?? this.profile,
      errorMessage: errorMessage ?? this.errorMessage,
    );
  }

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