import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/features/my_invoices/models/get_invoices_list_response_model.dart';
import 'package:hmg_patient_app_new/features/refund_request/models/resp_models/refund_request_list_response_model.dart';
import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
import 'package:hmg_patient_app_new/presentation/authentication/register.dart';
import 'package:hmg_patient_app_new/presentation/authentication/register_step2.dart';
import 'package:hmg_patient_app_new/presentation/blood_donation/blood_donation_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart';
import 'package:hmg_patient_app_new/presentation/child_vaccine/my_child_vaccine_page.dart';
import 'package:hmg_patient_app_new/presentation/comprehensive_checkup/comprehensive_checkup_page.dart';
import 'package:hmg_patient_app_new/presentation/covid19test/covid19_landing_page.dart';
import 'package:hmg_patient_app_new/presentation/e_referral/new_e_referral.dart';
import 'package:hmg_patient_app_new/presentation/emergency_services/emergency_services_page.dart';
import 'package:hmg_patient_app_new/presentation/habib_wallet/withdraw_request_create_page.dart';
import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculators_page.dart';
import 'package:hmg_patient_app_new/presentation/health_trackers/add_health_tracker_entry_page.dart';
import 'package:hmg_patient_app_new/presentation/health_trackers/health_tracker_detail_page.dart';
import 'package:hmg_patient_app_new/presentation/health_trackers/health_trackers_page.dart';
import 'package:hmg_patient_app_new/presentation/home/app_update_page.dart';
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
import 'package:hmg_patient_app_new/presentation/home_health_care/hhc_procedures_page.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart';
import 'package:hmg_patient_app_new/presentation/my_family/my_family.dart';
import 'package:hmg_patient_app_new/presentation/parking/paking_page.dart';
import 'package:hmg_patient_app_new/presentation/refund_request/refund_request_create_page.dart';
import 'package:hmg_patient_app_new/presentation/refund_request/refund_request_detail_screen.dart';
import 'package:hmg_patient_app_new/presentation/service_price/services_price_list_page.dart';
import 'package:hmg_patient_app_new/presentation/smartwatches/smartwatch_home_page.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/organ_selector_screen.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/possible_conditions_screen.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/risk_factors_screen.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/suggestions_screen.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/symptoms_selector_screen.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/triage_screen.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_consent_screen.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/user_info_flow_manager.dart';
import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection_screen.dart';
import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/call_screen.dart';
import 'package:hmg_patient_app_new/presentation/vital_sign/vital_sign_page.dart';
import 'package:hmg_patient_app_new/presentation/water_monitor/water_consumption_page.dart';
import 'package:hmg_patient_app_new/presentation/water_monitor/water_monitor_settings_page.dart';
import 'package:hmg_patient_app_new/presentation/weather/weather_details_page.dart';
import 'package:hmg_patient_app_new/splashPage.dart';
import 'package:provider/provider.dart';

import '../core/dependencies.dart';
import '../features/monthly_reports/monthly_reports_repo.dart';
import '../features/monthly_reports/monthly_reports_view_model.dart';
import '../features/qr_parking/qr_parking_view_model.dart';
import '../services/error_handler_service.dart';

class AppRoutes {
  static const String initialRoute = '/initialRoute';
  static const String loginScreen = '/loginScreen';
  static const String register = '/register';
  static const String registerStepTwo = '/registerStepTwo';
  static const String landingScreen = '/landingScreen';
  static const String medicalFilePage = '/medicalFilePage';
  static const String eReferralPage = '/erReferralPage';
  static const String comprehensiveCheckupPage = '/comprehensiveCheckupPage';
  static const String healthCalculatorsPage = '/healthCalculatorsPage';
  static const String healthConvertersPage = '/healthConvertersPage';
  static const String homeHealthCarePage = '/homeHealthCarePage';
  static const String zoomCallPage = '/zoomCallPage';
  static const String bloodDonationPage = '/bloodDonationPage';
  static const String myChildVaccine = '/myChildVaccine';
  static const String smartWatches = '/smartWatches';
  static const String huaweiHealthExample = '/huaweiHealthExample';
  static const String covid19Test = '/covid19Test';
  static const String vitalSign = '/vitalSign';
  static const String appUpdate = '/appUpdate';

  //appointments
  static const String bookAppointmentPage = '/bookAppointmentPage';

  // Water Monitor
  static const String waterConsumptionPage = '/waterConsumptionScreen';
  static const String waterMonitorSettingsPage = '/waterMonitorSettingsScreen';

  // Symptoms Checker
  static const String organSelectorPage = '/organSelectorPage';
  static const String symptomsSelectorPage = '/symptomsCheckerScreen';
  static const String suggestionsPage = '/suggestionsScreen';
  static const String riskFactorsPage = '/riskFactorsScreen';
  static const String possibleConditionsPage = '/possibleConditionsScreen';
  static const String triagePage = '/triageProgressScreen';
  static const String userInfoSelection = '/userInfoSelection';
  static const String userConsentScreen = '/userConsentScreen';
  static const String userInfoFlowManager = '/userInfoFlowManager';
  static const String monthlyReports = '/monthlyReportsPage';
  static const String qrParking = '/qrParkingPage';

  // Health Trackers
  static const String healthTrackersPage = '/healthTrackersListScreen';
  static const String addHealthTrackerEntryPage = '/addHealthTrackerEntryPage';
  static const String healthTrackerDetailPage = '/healthTrackerDetailPage';

  // Emergency Services
  static const String emergencyServicesPage = '/emergencyServicesPage';

  // Services Price List
  static const String servicesPriceListPage = '/servicesPriceListPage';

  // Weather
  static const String weatherDetailsPage = '/weatherDetailsPage';

  // Weather
  static const String familyFilesPage = '/familyFilesPage';

  // Refund Request
  static const String refundRequestCreatePage = '/refundRequestCreatePage';
  static const String createWithdrawRequest = '/createWithdrawRequest';
  static const String refundHistoryScreen = '/refundHistoryScreen';
  static const String refundRequestDetailScreen = '/refundRequestDetailScreen';

  static Map<String, WidgetBuilder> get routes => {
        initialRoute: (context) => SplashPage(),
        loginScreen: (context) => LoginScreen(),
        landingScreen: (context) => LandingNavigation(),
        register: (context) => RegisterNew(),
        registerStepTwo: (context) => RegisterNewStep2(),
        medicalFilePage: (context) => MedicalFilePage(),
        zoomCallPage: (context) => CallScreen(),
        eReferralPage: (context) => NewReferralPage(),
        comprehensiveCheckupPage: (context) => ComprehensiveCheckupPage(),
        homeHealthCarePage: (context) => HhcProceduresPage(),
        organSelectorPage: (context) => OrganSelectorPage(),
        symptomsSelectorPage: (context) => SymptomsSelectorPage(),
        riskFactorsPage: (context) => RiskFactorsScreen(),
        suggestionsPage: (context) => SuggestionsScreen(),
        possibleConditionsPage: (context) => PossibleConditionsPage(),
        triagePage: (context) => TriagePage(),
        bloodDonationPage: (context) => BloodDonationPage(),
        myChildVaccine: (context) => MyChildVaccinePage(),
        bookAppointmentPage: (context) => BookAppointmentPage(),
        userInfoSelection: (context) => UserInfoSelectionScreen(),
        userConsentScreen: (context) => UserConsentScreen(),
        userInfoFlowManager: (context) => UserInfoFlowManager(),
        smartWatches: (context) => SmartwatchHomePage(),
        // huaweiHealthExample: (context) => HuaweiHealthExample(),
        covid19Test: (context) => Covid19LandingPage(),
        waterConsumptionPage: (context) => WaterConsumptionPage(),
        waterMonitorSettingsPage: (context) => WaterMonitorSettingsPage(),
        healthCalculatorsPage: (context) => HealthCalculatorsPage(type: HealthCalConEnum.calculator),
        healthConvertersPage: (context) => HealthCalculatorsPage(type: HealthCalConEnum.converter),
        healthTrackersPage: (context) => HealthTrackersPage(),
        vitalSign: (context) => VitalSignPage(),
        appUpdate: (context) => AppUpdatePage(
              appUpdateMessage: '',
            ),
        emergencyServicesPage: (context) => EmergencyServicesPage(),
        servicesPriceListPage: (context) => ServicesPriceListPage(),
        weatherDetailsPage: (context) => WeatherDetailsPage(),
        familyFilesPage: (context) => FamilyMedicalScreen(),
        addHealthTrackerEntryPage: (context) {
          final args = ModalRoute.of(context)?.settings.arguments as HealthTrackerTypeEnum?;
          return AddHealthTrackerEntryPage(
            trackerType: args ?? HealthTrackerTypeEnum.bloodSugar,
          );
        },
        healthTrackerDetailPage: (context) {
          final args = ModalRoute.of(context)?.settings.arguments as HealthTrackerTypeEnum?;
          return HealthTrackerDetailPage(
            trackerType: args ?? HealthTrackerTypeEnum.bloodSugar,
          );
        },
        monthlyReports: (context) => ChangeNotifierProvider(
              create: (_) => MonthlyReportsViewModel(
                monthlyReportsRepo: getIt<MonthlyReportsRepo>(),
                errorHandlerService: getIt<ErrorHandlerService>(),
              ),
            ),
        qrParking: (context) => ChangeNotifierProvider<QrParkingViewModel>(
              create: (_) => getIt<QrParkingViewModel>(),
              child: const ParkingPage(),
            ),
        refundRequestCreatePage: (context) {
          final args = ModalRoute.of(context)?.settings.arguments as GetInvoicesListResponseModel;
          return RefundRequestCreatePage(invoice: args);
        },
        createWithdrawRequest: (context) {
          return WithdrawRequestCreatePage();
        },
        refundRequestDetailScreen: (context) {
          final args = ModalRoute.of(context)?.settings.arguments as RefundInvoiceModel;
          return RefundRequestDetailScreen(invoice: args);
        },
      };
}
