import 'package:citycards_customer/Profile/profile_page_view.dart';
import 'package:citycards_customer/common_bloc/language_selection_bloc.dart';
import 'package:citycards_customer/contact_us/contact_us_view.dart';
import 'package:citycards_customer/edit_profile/edit_profile_view.dart';
import 'package:citycards_customer/faq/faq_view.dart';
import 'package:citycards_customer/itinerary_creation/bloc/itinerary_steps_selection_bloc.dart';
import 'package:citycards_customer/itinerary_creation/views/itinerary_creation_start_view.dart';
import 'package:citycards_customer/itinerary_creation/views/itinerary_creation_view.dart';
import 'package:citycards_customer/privacy/privacy_view.dart';
import 'package:citycards_customer/terms_and_condition/terms_and_condition_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../common_bloc/bottom_navigation_bloc.dart';
import '../home/views/home_page_view.dart';
import 'route_constants.dart';

class AppRouter {
  Route onGenerateRoute(RouteSettings settings) {
    switch (settings.name) {
      case '/':
      case RouteConstants.home:
        return MaterialPageRoute(
          builder: (_) {
            return BlocProvider(
              create: (_) => NavigationBloc(),
              child: const HomePage(),
            );
          },
        );

      case RouteConstants.profile:
        return MaterialPageRoute(
          builder: (_) {
            return BlocProvider(
              create: (_) => LanguageBloc(),
              child: const ProfilePage(),
            );
          },
        );
      case RouteConstants.editProfile:
        return MaterialPageRoute(
          builder: (_) {
            return const EditProfilePage();
          },
        );
      case RouteConstants.contactUs:
        return MaterialPageRoute(
          builder: (_) {
            return const ContactUsPage();
          },
        );
      case RouteConstants.faq:
        return MaterialPageRoute(
          builder: (_) {
            return const FaqPage();
          },
        );
      case RouteConstants.termsAndCondition:
        return MaterialPageRoute(
          builder: (_) {
            return const TermsAndCondition();
          },
        );
      case RouteConstants.privacyPolicy:
        return MaterialPageRoute(
          builder: (_) {
            return const PrivacyPolicyPage();
          },
        );

      case RouteConstants.itineraryCreationStart:
        return MaterialPageRoute(
          builder: (_) {
            return ItineraryCreationStartPage();
          },
        );

      case RouteConstants.itineraryCreation:
        return MaterialPageRoute(
          builder: (_) {
            return BlocProvider(create: (_) => ItineraryStepNavigationBloc(),
            child: ItineraryCreationPage(),
            );
          },
        );
      default:
        return MaterialPageRoute(
          builder: (_) =>
              const Scaffold(body: Center(child: Text('404 - Page Not Found'))),
        );
    }
  }
}
