import 'package:equatable/equatable.dart';
import '../../models/user.dart';

/// Abstract base class for all authentication states.
/// 
/// This class extends [Equatable] to enable value equality for state comparison.
/// All authentication states in the application should inherit from this class.
abstract class AuthState extends Equatable {
  /// Creates a new [AuthState].
  const AuthState();

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

/// Initial state of the authentication bloc.
/// 
/// This state represents the initial state before any authentication
/// actions have been performed.
class AuthInitial extends AuthState {}

/// State indicating that an authentication operation is in progress.
/// 
/// This state is used to show loading indicators during authentication
/// processes like sign-in, sign-up, or sign-out.
class AuthLoading extends AuthState {}

/// State indicating that a user is successfully authenticated.
/// 
/// This state contains the authenticated user's information and is
/// used throughout the app to access user data.
class AuthAuthenticated extends AuthState {
  /// The authenticated user.
  final User user;

  /// Creates an [AuthAuthenticated] state with the given [user].
  const AuthAuthenticated({required this.user});

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

/// State indicating that no user is currently authenticated.
/// 
/// This state is used when a user is not signed in or has signed out
/// of the application.
class AuthUnauthenticated extends AuthState {}

/// State indicating that an authentication error has occurred.
/// 
/// This state contains an error message that can be displayed to the user
/// when authentication operations fail.
class AuthError extends AuthState {
  /// The error message describing what went wrong.
  final String message;

  /// Creates an [AuthError] state with the given error [message].
  const AuthError({required this.message});

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

/// State indicating that a password reset email has been sent.
/// 
/// This state is used to confirm to the user that a password reset
/// email has been successfully sent to their email address.
class AuthPasswordResetSent extends AuthState {
  /// The email address to which the reset link was sent.
  final String email;

  /// Creates an [AuthPasswordResetSent] state with the given [email].
  const AuthPasswordResetSent({required this.email});

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