import 'package:flutter/cupertino.dart';
import 'package:food_delivery_client/feature/auth/presentation/pages/create_new_password_page/create_new_password_page.dart';
import 'package:food_delivery_client/feature/auth/presentation/pages/forgot_password_page/forgot_password_page.dart';
import 'package:food_delivery_client/feature/auth/presentation/pages/login_page/login_page.dart';
import 'package:food_delivery_client/feature/auth/presentation/pages/verify_account_page/verify_account_page.dart';
import 'package:food_delivery_client/feature/onboarding/presentation/pages/onboarding_page/onboarding_page.dart';
import 'package:food_delivery_client/feature/onboarding/presentation/pages/splash_page/splash_page.dart';

import '../../food_delivery_client.dart';

final GlobalKey<NavigatorState> navigatorKey = GlobalKey();

@singleton
class AppRoutes {
  final GoRouter router = GoRouter(
    navigatorKey: navigatorKey,
    initialLocation: Routes.splash,
    routes: [
      GoRoute(
        path: Routes.splash,
        pageBuilder: (context, state) => CupertinoPage(child: SplashPage()),
      ),
      GoRoute(
        path: Routes.onBoarding,
        pageBuilder: (context, state) => CupertinoPage(child: OnboardingPage()),
      ),

      GoRoute(
        path: Routes.login,
        pageBuilder: (context, state) => CupertinoPage(child: LoginPage()),
      ),
      GoRoute(
        path: Routes.main,
        pageBuilder: (context, state) => CupertinoPage(child: MainPage()),
      ),
      GoRoute(
        path: Routes.forgotPassword,
        pageBuilder: (context, state) =>
            CupertinoPage(child: ForgotPasswordPage()),
      ),
      GoRoute(
        path: Routes.verifyAccount,
        pageBuilder: (context, state) => CupertinoPage(
          child: VerifyAccountPage(phoneNumber: state.extra as String),
        ),
      ),
      GoRoute(
        path: Routes.createNewPassword,
        pageBuilder: (context, state) => CupertinoPage(
          child: CreateNewPasswordPage(phoneNumber: state.extra as String),
        ),
      ),
    ],
  );
}
