import 'package:equatable/equatable.dart';

abstract class AuthState extends Equatable {
  const AuthState();

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

class AuthInitial extends AuthState {}

class AuthLoading extends AuthState {
  final String? message;

  const AuthLoading({this.message});

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

class SignupInProgress extends AuthState {
  final String username;
  final String email;
  final String displayName;

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

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

class RegistrationChallengeReceived extends AuthState {
  final String userId;
  final String challenge;
  final String rpName;
  final String rpId;

  const RegistrationChallengeReceived({
    required this.userId,
    required this.challenge,
    required this.rpName,
    required this.rpId,
  });

  @override
  List<Object> get props => [userId, challenge, rpName, rpId];
}

class AuthenticationChallengeReceived extends AuthState {
  final String challenge;
  final List<String> credentialIds;

  const AuthenticationChallengeReceived({
    required this.challenge,
    required this.credentialIds,
  });

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

class AuthAuthenticated extends AuthState {
  final String token;
  final String userId;
  final String username;
  final String email;

  const AuthAuthenticated({
    required this.token,
    required this.userId,
    required this.username,
    required this.email,
  });

  @override
  List<Object> get props => [token, userId, username, email];
}

class AuthFailure extends AuthState {
  final String error;

  const AuthFailure(this.error);

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

class AuthUnauthenticated extends AuthState {
  const AuthUnauthenticated();

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