import 'package:flutter/material.dart';
import '../booking/views/booking_page.dart';
import '../booking/views/selected_time_slot_page.dart';
import '../login/views/forgot_password_page.dart';
import '../login/views/login_page.dart';
import '../login/views/otp_verification_page.dart';
import '../login/views/reset_password_page.dart';
import '../onboarding/views/onboarding_page.dart';
import '../profile/views/profile_page.dart';
import '../recurring/views/recurring_block.dart';
import '../redemption/view/ticket_redemption_screen.dart';
import '../scan/view/qr_scan_screen.dart';
import '../scan_history/views/scan_history_detail_page.dart';
import '../scan_history/views/scan_history_page.dart';
import '../splash/view/splash_view.dart';
import '../support/view/help_support_page.dart';

class AppRouter {
  static const String onboarding = '/onboarding';
  static const String login = '/login';
  static const String home = '/home';
  static const String ticketRedemptionScreen = '/ticketRedemptionScreen';
  static const String qrScanScreen = '/qrScanScreen';
  static const String scanHistory = '/scanHistory';
  static const String forgotPassword = '/forgot_password';
  static const String splashScreen = '/';
  static const String otpVerification = '/otp_verification';
  static const String resetPassword = '/reset_password';
  static const String profileScreen = '/profile_screen';
  static const String bookingPage = '/booking_page';
  static const String selectedTimeSlotPage = '/selected_time_slot_page';
  static const String helpSupportPage = '/help_support_page';
  static const String scanHistoryDetailPage = '/ScanHistoryDetailPage';

  static const String recurringBlockBasicInfo = '/RecurringBlockBasicInfo';

  static Route<dynamic> generateRoute(RouteSettings settings) {
    switch (settings.name) {
      case onboarding:
        return MaterialPageRoute(builder: (_) => const OnboardingPage());
      case login:
        return MaterialPageRoute(builder: (_) => const LoginPage());
      case scanHistory:
        return MaterialPageRoute(builder: (_) => const ScanHistoryPage());
      case forgotPassword:
        return MaterialPageRoute(builder: (_) => const ForgotPasswordPage());
      case otpVerification:
        final email = settings.arguments as String? ?? '';
        return MaterialPageRoute(
          builder: (_) => OtpVerificationPage(email: email),
        );
      case resetPassword:
        final email = settings.arguments as String? ?? '';
        return MaterialPageRoute(
          builder: (_) => ResetPasswordPage(email: email),
        );
      case profileScreen:
        return MaterialPageRoute(builder: (_) => const ProfileScreen());
      case qrScanScreen:
        return MaterialPageRoute(builder: (_) => const QrScanScreen());
      case splashScreen:
        return MaterialPageRoute(builder: (_) => const SplashScreen());
      case scanHistoryDetailPage:
        final passId = settings.arguments as int? ?? 0;
        return MaterialPageRoute(
            builder: (_) => ScanHistoryDetailPage(
                  passId: passId,
                ));
      case selectedTimeSlotPage:
        return MaterialPageRoute(builder: (_) => const SelectedTimeSlotPage());
      case bookingPage:
        return MaterialPageRoute(builder: (_) => const BookingPage());
      case helpSupportPage:
        return MaterialPageRoute(builder: (_) => const HelpSupportPage());
      case ticketRedemptionScreen:
        return MaterialPageRoute(
            builder: (_) => const TicketRedemptionScreen());
      case recurringBlockBasicInfo:
        return MaterialPageRoute(builder: (_) => const RecurringBlockPage());
      default:
        return MaterialPageRoute(
          builder: (_) =>
              const Scaffold(body: Center(child: Text('No route defined'))),
        );
    }
  }
}