content: import 'package:bb_mobile/core/recoverbull/domain/entity/encrypted_vault.dart';
  import 'package:bb_mobile/core/recoverbull/domain/usecases/decrypt_vault_usecase.dart';
  import 'package:bb_mobile/core/recoverbull/domain/usecases/restore_vault_usecase.dart';
  import 'package:bb_mobile/core/wallet/domain/usecases/check_liquid_wallet_status_usecase.dart';
  import 'package:bb_mobile/core/wallet/domain/usecases/check_wallet_status_usecase.dart';
  import 'package:bb_mobile/features/recoverbull_vault_recovery/presentation/cubit.dart';
  import 'package:bb_mobile/features/recoverbull_vault_recovery/presentation/state.dart';
  import 'package:bb_mobile/features/recoverbull_vault_recovery/ui/recoverbull_vault_recovery_page.dart';
  import 'package:bb_mobile/features/wallet/presentation/bloc/wallet_bloc.dart';
  import 'package:bb_mobile/features/wallet/ui/wallet_router.dart';
  import 'package:bb_mobile/locator.dart';
  import 'package:flutter_bloc/flutter_bloc.dart';
  import 'package:go_router/go_router.dart';
  
  enum RecoverBullVaultRecovery {
    recoverbullVaultRecovery('/recoverbull/vault-recovery');
  
    final String path;
  
    const RecoverBullVaultRecovery(this.path);
  }
  
  class RecoverBullVaultRecoveryRouter {
    static final route = GoRoute(
      name: RecoverBullVaultRecovery.recoverbullVaultRecovery.name,
      path: RecoverBullVaultRecovery.recoverbullVaultRecovery.path,
      builder: (context, state) {
        final (backup: vault, backupKey: vaultKey) =
            state.extra! as ({EncryptedVault backup, String backupKey});
  
        return BlocProvider(
          create:
              (context) => RecoverBullVaultRecoveryCubit(
                vault: vault,
                vaultKey: vaultKey,
                decryptVaultUsecase: locator<DecryptVaultUsecase>(),
                restoreVaultUsecase: locator<RestoreVaultUsecase>(),
                checkWalletStatusUsecase: locator<TheDirtyUsecase>(),
                checkLiquidWalletStatusUsecase: locator<TheDirtyLiquidUsecase>(),
              ),
          child: BlocListener<
            RecoverBullVaultRecoveryCubit,
            RecoverBullVaultRecoveryState
          >(
            listenWhen:
                (previous, current) => !previous.isImported && current.isImported,
            listener: (context, state) {
              context.read<WalletBloc>().add(const WalletStarted());
              context.goNamed(WalletRoute.walletHome.name);
            },
            child: const RecoverBullVaultRecoveryPage(),
          ),
        );
      },
    );
  }
  