// router.dart

import 'package:go_router/go_router.dart';
import 'package:tanami_app/core/routes/route_name.dart';
import 'package:tanami_app/features/MainScreens/Academy/presentation/pages/academy_details_screen.dart';
import 'package:tanami_app/features/MainScreens/Invest/presentation/pages/invest_details_screen.dart';
import 'package:tanami_app/features/MainScreens/Invest/presentation/pages/payment/confirm_investment_screen.dart';
import 'package:tanami_app/features/MainScreens/Invest/presentation/pages/payment/invest_payment_screen.dart';
import 'package:tanami_app/features/MainScreens/Portfolio/presentation/pages/portfolio_details_screen.dart';
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/deposit/depositScreen.dart';
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/deposit/preview.dart';
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/filter_screen.dart';
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/walletDetails.dart';
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/withdrawal/confirmation.dart';
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/withdrawal/preview.dart';
import 'package:tanami_app/features/MainScreens/Wallet/presentation/pages/withdrawal/withdrawalScreen.dart';
import 'package:tanami_app/features/biometric/presentation/pages/biometric_screen.dart';
import 'package:tanami_app/features/changePassword/presentation/pages/change_password_screen.dart';
import 'package:tanami_app/features/contactAdmin/presentation/pages/contact_admin_screen.dart';
import 'package:tanami_app/features/countrySelection/presentation/pages/choose_country_screen.dart';
import 'package:tanami_app/features/deleteAccount/presentation/pages/delete_account_screen.dart';
import 'package:tanami_app/features/faq/presentation/pages/faq_screen.dart';
import 'package:tanami_app/features/forgotPassword/presentation/pages/restore_password_screen.dart';
import 'package:tanami_app/features/languageChange/presentation/pages/language_change_screen.dart';
import 'package:tanami_app/features/otpVerification/presentation/pages/otp_screen.dart';
import 'package:tanami_app/features/register/presentation/pages/register_screen.dart';
import 'package:tanami_app/features/register/presentation/pages/register_step_screen.dart';
import 'package:tanami_app/features/securePin/presentation/pages/pin_screen.dart';
import 'package:tanami_app/features/welcome/presentation/pages/weclome_screen.dart';
import 'package:tanami_app/shared/components/no_internet.dart';

import '../../features/MainScreens/main_screen.dart';
import '../../features/forgotPassword/presentation/pages/restore_password_phone_verification_screen.dart';
import '../../features/login/presentation/pages/login_screen.dart';
import '../../features/register/presentation/pages/register_user_details_screen.dart';
import '../../features/securePin/presentation/pages/confirm_pin_screen.dart';
import '../../features/splash/presentation/pages/splash_screen.dart';

/* CREATED BY - JAYESH JAIN 
   DATE - 24-05-2024 
 */

// The GoRouter instance used to navigate between screens.
final goRouter = GoRouter(
  initialLocation: '/',
  //errorBuilder: (context, state) => ErrorScreen(state.error),
  routes: [
    GoRoute(
      name: "splash",
      path: RouteName.splashScreen,
      builder: (context, state) {
        return const SplashScreen();
      },
      routes: [
        GoRoute(
          name: RouteName.loginScreen,
          path: "${RouteName.loginScreen}/:fromScreen",
          builder: (context, state) {
            return LoginScreen(
              fromScreen: state.pathParameters["fromScreen"]!,
            );
          },
        ),
        GoRoute(
          name: RouteName.registerStepScreen,
          path: "${RouteName.registerStepScreen}/:fromScreentype",
          builder: (context, state) {
            return RegisterStepScreen(
              fromScreen: state.pathParameters["fromScreentype"]!,
            );
          },
        ),
        GoRoute(
          name: RouteName.welcomeScreen,
          path: RouteName.welcomeScreen,
          builder: (context, state) {
            return const WelcomeScreen();
          },
        ),
        GoRoute(
          name: RouteName.chooseCountryScreen,
          path: RouteName.chooseCountryScreen,
          builder: (context, state) {
            return const ChooseCountryScreen();
          },
        ),
        GoRoute(
          name: RouteName.mainScreen,
          path: RouteName.mainScreen,
          builder: (context, state) {
            return const MainScreen();
          },
        ),
        GoRoute(
          name: RouteName.biometricScreen,
          path: RouteName.biometricScreen,
          builder: (context, state) {
            return const BiometricScreen();
          },
        ),
        GoRoute(
          name: RouteName.registerScreen,
          path: RouteName.registerScreen,
          builder: (context, state) {
            return const RegisterScreen();
          },
        ),
        GoRoute(
          name: RouteName.registerUserDetailsScreen,
          path: RouteName.registerUserDetailsScreen,
          builder: (context, state) {
            return const RegisterUserDetailsScreen();
          },
        ),
        GoRoute(
          name: RouteName.otpScreen,
          path: "${RouteName.otpScreen}/:fromScreen",
          builder: (context, state) {
            return OtpScreen(
              fromScreen: state.pathParameters["fromScreen"]!,
            );
          },
        ),
        GoRoute(
          name: RouteName.porfolioDetails,
          path: RouteName.porfolioDetails,
          builder: (context, state) {
            return const DetailsScreen();
          },
        ),
        GoRoute(
          name: RouteName.academyDetails,
          path: RouteName.academyDetails,
          builder: (context, state) {
            return const AcademyDetailsScreen();
          },
        ),
        GoRoute(
          name: RouteName.pinScreen,
          path: "${RouteName.pinScreen}/:fromScreen",
          builder: (context, state) {
            return PinScreen(
              fromScreen: state.pathParameters["fromScreen"]!,
            );
          },
        ),
        GoRoute(
          name: RouteName.confirmPinScreen,
          path: RouteName.confirmPinScreen,
          builder: (context, state) {
            return const ConfirmPinScreen();
          },
        ),
        GoRoute(
          name: RouteName.forgotPasswordPhoneVerificationScreen,
          path: RouteName.forgotPasswordPhoneVerificationScreen,
          builder: (context, state) {
            return const RestorePasswordPhoneVerificationScreen();
          },
        ),
        GoRoute(
          name: RouteName.forgotPasswordScreen,
          path: RouteName.forgotPasswordScreen,
          builder: (context, state) {
            return const RestorePasswordScreen();
          },
        ),
        GoRoute(
            name: RouteName.walletDetails,
            path: "${RouteName.walletDetails}/:type",
            builder: (context, state) {
              return WalletDetails(
                type: state.pathParameters["type"]!,
              );
            }),
        GoRoute(
          name: RouteName.filterScreen,
          path: RouteName.filterScreen,
          builder: (context, state) {
            return const FilterScreen();
          },
        ),
        GoRoute(
          name: RouteName.withdrawalScreen,
          path: RouteName.withdrawalScreen,
          builder: (context, state) {
            return const WithdrawalScreen();
          },
        ),
        GoRoute(
          name: RouteName.withdrawalPreview,
          path: RouteName.withdrawalPreview,
          builder: (context, state) {
            return const WithdrawalPreview();
          },
        ),
        GoRoute(
          name: RouteName.withdrawalConfirmation,
          path: RouteName.withdrawalConfirmation,
          builder: (context, state) {
            return const WithdrawalConfirmation();
          },
        ),
        GoRoute(
          name: RouteName.depositScreen,
          path: RouteName.depositScreen,
          builder: (context, state) {
            return const DepositScreen();
          },
        ),
        GoRoute(
          name: RouteName.depositPreview,
          path: RouteName.depositPreview,
          builder: (context, state) {
            return const DepositPreview();
          },
        ),
        GoRoute(
          name: RouteName.contactAdminScreen,
          path: RouteName.contactAdminScreen,
          builder: (context, state) {
            return const ContactAdminScreen();
          },
        ),
        GoRoute(
          name: RouteName.languageChangeScreen,
          path: RouteName.languageChangeScreen,
          builder: (context, state) {
            return const LanguageChaneScreen();
          },
        ),
        GoRoute(
          name: RouteName.deleteAccountScreen,
          path: RouteName.deleteAccountScreen,
          builder: (context, state) {
            return const DeleteAccountScreen();
          },
        ),
        GoRoute(
          name: RouteName.changePasswordScreen,
          path: RouteName.changePasswordScreen,
          builder: (context, state) {
            return const ChangePasswordScreen();
          },
        ),
        GoRoute(
          name: RouteName.investDetailScreen,
          path: "${RouteName.investDetailScreen}/:type",
          builder: (context, state) {
            return InvestDetailsScreen(
              type: state.pathParameters["type"]!,
            );
          },
        ),
        GoRoute(
          name: RouteName.investPaymentScreen,
          path: RouteName.investPaymentScreen,
          builder: (context, state) {
            return const InvestPaymentScreen();
          },
        ),
        GoRoute(
          name: RouteName.confirmInvestScreen,
          path: RouteName.confirmInvestScreen,
          builder: (context, state) {
            return const ConfirmInvestmentScreen();
          },
        ),
        GoRoute(
          name: RouteName.noInternetScreen,
          path: RouteName.noInternetScreen,
          builder: (context, state) {
            return const NoInternet();
          },
        ),
        GoRoute(
          name: RouteName.faqScreen,
          path: RouteName.faqScreen,
          builder: (context, state) {
            return const FAQScreen();
          },
        ),
      ],
    ),
  ],
);
