part of 'reset_password_bloc.dart';

enum ResetPasswordStatus { initial, loading, success, failure }

class ResetPasswordState extends Equatable {
  final ResetPasswordStatus status;
  final bool isPasswordVisible;
  final bool isConfirmPasswordVisible;
  final String? errorMessage;
  
  // Validation flags
  final bool hasMinLength;
  final bool hasUppercase;
  final bool hasLowercase;
  final bool hasNumber;
  final bool hasSpecial;

  final bool showPasswordError;
  final bool showConfirmPasswordError;
  final String? passwordErrorText;
  final String? confirmPasswordErrorText;

  const ResetPasswordState({
    this.status = ResetPasswordStatus.initial,
    this.isPasswordVisible = false,
    this.isConfirmPasswordVisible = false,
    this.errorMessage,
    this.hasMinLength = false,
    this.hasUppercase = false,
    this.hasLowercase = false,
    this.hasNumber = false,
    this.hasSpecial = false,
    this.showPasswordError = false,
    this.showConfirmPasswordError = false,
    this.passwordErrorText,
    this.confirmPasswordErrorText,
  });

  bool get isPasswordValid =>
      hasMinLength && hasUppercase && hasLowercase && hasNumber && hasSpecial;

  ResetPasswordState copyWith({
    ResetPasswordStatus? status,
    bool? isPasswordVisible,
    bool? isConfirmPasswordVisible,
    String? errorMessage,
    bool? hasMinLength,
    bool? hasUppercase,
    bool? hasLowercase,
    bool? hasNumber,
    bool? hasSpecial,
    bool? showPasswordError,
    bool? showConfirmPasswordError,
    String? passwordErrorText,
    String? confirmPasswordErrorText,
  }) {
    return ResetPasswordState(
      status: status ?? this.status,
      isPasswordVisible: isPasswordVisible ?? this.isPasswordVisible,
      isConfirmPasswordVisible: isConfirmPasswordVisible ?? this.isConfirmPasswordVisible,
      errorMessage: errorMessage ?? this.errorMessage,
      hasMinLength: hasMinLength ?? this.hasMinLength,
      hasUppercase: hasUppercase ?? this.hasUppercase,
      hasLowercase: hasLowercase ?? this.hasLowercase,
      hasNumber: hasNumber ?? this.hasNumber,
      hasSpecial: hasSpecial ?? this.hasSpecial,
      showPasswordError: showPasswordError ?? this.showPasswordError,
      showConfirmPasswordError: showConfirmPasswordError ?? this.showConfirmPasswordError,
      passwordErrorText: passwordErrorText ?? this.passwordErrorText,
      confirmPasswordErrorText: confirmPasswordErrorText ?? this.confirmPasswordErrorText,
    );
  }

  @override
  List<Object?> get props => [
        status,
        isPasswordVisible,
        isConfirmPasswordVisible,
        errorMessage,
        hasMinLength,
        hasUppercase,
        hasLowercase,
        hasNumber,
        hasSpecial,
        showPasswordError,
        showConfirmPasswordError,
        passwordErrorText,
        confirmPasswordErrorText,
      ];
}