part of 'auth_bloc.dart';

enum AuthType { login, register }

class AuthState {
  final AuthType? authType;
  final String? phoneError;
  String? codeError;
  final bool needClearPhone;
  final bool needNavigateToCodeVerification;
  final bool isLoading;
  final bool autentificated;
  final int resendTimeout;

  AuthState({
    this.phoneError,
    this.codeError,
    this.needClearPhone = false,
    this.needNavigateToCodeVerification = false,
    this.isLoading = false,
    this.authType,
    this.autentificated = false,
    this.resendTimeout = 0,
  });

  AuthState copyWith({
    AuthType? authType,
    String? phoneError,
    String? codeError,
    bool? needClearPhone,
    bool? needNavigateToCodeVerification,
    bool? isLoading,
    bool? autentificated,
    int? resendTimeout,
  }) {
    return AuthState(
      authType: authType ?? this.authType,
      phoneError: phoneError,
      codeError: codeError,
      needClearPhone: needClearPhone ?? false,
      needNavigateToCodeVerification: needNavigateToCodeVerification ?? false,
      isLoading: isLoading ?? false,
      autentificated: autentificated ?? false,
      resendTimeout: resendTimeout ?? this.resendTimeout,
    );
  }
}
