import 'package:equatable/equatable.dart';

abstract class AuthEvent extends Equatable {
  const AuthEvent();

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

// Signup events
class SignupStarted extends AuthEvent {
  final String username;
  final String email;
  final String displayName;
  final String? password;

  const SignupStarted({
    required this.username,
    required this.email,
    required this.displayName,
    this.password,
  });

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

class RegistrationChallengeRequested extends AuthEvent {
  final String userId;

  const RegistrationChallengeRequested({required this.userId});

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

class RegistrationResponseSubmitted extends AuthEvent {
  final String userId;
  final String challenge;
  final String credentialId;
  final String publicKey;
  final String clientDataJSON;
  final String attestationObject;

  const RegistrationResponseSubmitted({
    required this.userId,
    required this.challenge,
    required this.credentialId,
    required this.publicKey,
    required this.clientDataJSON,
    required this.attestationObject,
  });

  @override
  List<Object> get props => [
    userId,
    challenge,
    credentialId,
    publicKey,
    clientDataJSON,
    attestationObject,
  ];
}

// Login events
class LoginRequested extends AuthEvent {
  final String username;

  const LoginRequested({required this.username});

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

class AuthenticationChallengeRequested extends AuthEvent {
  final String username;

  const AuthenticationChallengeRequested({required this.username});

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

class AuthenticationResponseSubmitted extends AuthEvent {
  final String username;
  final String challenge;
  final String credentialId;
  final String authenticatorData;
  final String clientDataJSON;
  final String signature;

  const AuthenticationResponseSubmitted({
    required this.username,
    required this.challenge,
    required this.credentialId,
    required this.authenticatorData,
    required this.clientDataJSON,
    required this.signature,
  });

  @override
  List<Object> get props => [
    username,
    challenge,
    credentialId,
    authenticatorData,
    clientDataJSON,
    signature,
  ];
}

class LogoutRequested extends AuthEvent {
  const LogoutRequested();

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

class CheckAuthRequested extends AuthEvent {
  const CheckAuthRequested();

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

class PasswordLoginRequested extends AuthEvent {
  final String username;
  final String password;

  const PasswordLoginRequested({
    required this.username,
    required this.password,
  });

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