import 'package:equatable/equatable.dart';

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

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

/// Event to check the current authentication status.
///
/// This event is typically dispatched when the app starts to determine
/// if a user is already authenticated.
class AuthCheckRequested extends AuthEvent {}

/// Event to request user sign-in with email and password.
///
/// This event contains the user's credentials and triggers the authentication
/// process when dispatched to the [AuthBloc].
class AuthSignInRequested extends AuthEvent {
  /// The user's email address.
  final String email;

  /// The user's password.
  final String password;

  /// Creates a new [AuthSignInRequested] event.
  ///
  /// Both [email] and [password] are required parameters.
  const AuthSignInRequested({required this.email, required this.password});

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

/// Event to request user registration with email, password, and personal information.
///
/// This event contains all necessary information to create a new user account
/// and triggers the registration process when dispatched to the [AuthBloc].
class AuthSignUpRequested extends AuthEvent {
  /// The user's email address.
  final String email;

  /// The user's password.
  final String password;

  /// The user's last name.
  final String nom;

  /// The user's first name.
  final String prenom;

  /// The user's phone number.
  final String phoneNumber;

  /// Creates a new [AuthSignUpRequested] event.
  ///
  /// All parameters are required for user registration.
  const AuthSignUpRequested({
    required this.email,
    required this.password,
    required this.nom,
    required this.prenom,
    required this.phoneNumber,
  });

  @override
  List<Object?> get props => [email, password, nom, prenom];
}

/// Event to request user sign-in using Google authentication.
///
/// This event triggers the Google sign-in flow when dispatched to the [AuthBloc].
class AuthGoogleSignInRequested extends AuthEvent {}

class AuthGoogleSignUpRequested extends AuthEvent {
  /// The user's phone number.
  final String phoneNumber;
  final String name;
  final String firstname;

  /// Creates a new [AuthGoogleSignUpRequested] event.
  ///
  /// The [phoneNumber] parameter is required.
  const AuthGoogleSignUpRequested({
    required this.phoneNumber,
    required this.name,
    required this.firstname,
  });

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

/// Event to request user sign-in using Apple authentication.
///
/// This event triggers the Apple sign-in flow when dispatched to the [AuthBloc].
class AuthAppleSignInRequested extends AuthEvent {}

class AuthAppleSignUpRequested extends AuthEvent {
  /// The user's phone number.
  final String phoneNumber;
  final String name;
  final String firstname;

  /// Creates a new [AuthAppleSignUpRequested] event.
  ///
  /// The [phoneNumber] parameter is required.
  const AuthAppleSignUpRequested({
    required this.phoneNumber,
    required this.name,
    required this.firstname,
  });

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

/// Event to request user sign-out.
///
/// This event triggers the sign-out process and clears the user session
/// when dispatched to the [AuthBloc].
class AuthSignOutRequested extends AuthEvent {}

/// Event to request a password reset for a user account.
///
/// This event triggers the password reset process by sending a reset email
/// to the specified email address.
class AuthPasswordResetRequested extends AuthEvent {
  /// The email address to send the password reset link to.
  final String email;

  /// Creates a new [AuthPasswordResetRequested] event.
  ///
  /// The [email] parameter is required.
  const AuthPasswordResetRequested({required this.email});

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