import 'package:flutter/material.dart';
import 'navigation_provider.dart';
import '../pages/auth/login_page.dart';
import '../pages/home/home_page.dart';
import '../pages/chart/trend_page.dart';
import '../pages/medication/medication_list_page.dart';
import '../pages/medication/medication_edit_page.dart';
import '../pages/report/report_pages.dart';
import '../pages/report/ai_analysis_page.dart';
import '../pages/consultation/consultation_pages.dart';
import '../pages/settings/settings_pages.dart';
import '../pages/settings/notification_prefs_page.dart';
import '../pages/profile/profile_page.dart';
import '../pages/profile/profile_detail_page.dart';
import '../pages/profile/service_package_detail_page.dart';
import '../pages/diet/diet_capture_page.dart';
import '../pages/remaining_pages.dart';

/// 根据路由信息返回对应页面
Widget buildPage(RouteInfo route) {
  final params = route.params;
  switch (route.name) {
    case 'login':
      return const LoginPage();
    case 'home':
      return const HomePage();
    case 'trend':
      return TrendPage(metricType: params['type'] ?? '');
    case 'calendar':
      return const HealthCalendarPage();
    case 'medications':
      return const MedicationListPage();
    case 'medicationEdit':
      return const MedicationEditPage();
    case 'reports':
      return const ReportListPage();
    case 'reportDetail':
      return ReportDetailPage(id: params['id']!);
    case 'aiAnalysis':
      return const AiAnalysisPage();
    case 'doctors':
      return const DoctorListPage();
    case 'consultation':
      return DoctorChatPage(id: params['id']!);
    case 'exercisePlan':
      return const ExercisePlanPage();
    case 'exerciseCreate':
      return const ExercisePlanCreatePage();
    case 'dietRecords':
      return const DietRecordListPage();
    case 'dietCapture':
      return const DietCapturePage();
    case 'profile':
      return const ProfilePage();
    case 'profileEdit':
      return const ProfileDetailPage();
    case 'editProfile':
      return const EditProfilePage();
    case 'devices':
      return const DeviceManagementPage();
    case 'healthArchive':
      return const HealthArchivePage();
    case 'followups':
      return const FollowUpListPage();
    case 'settings':
      return const SettingsPage();
    case 'notificationPrefs':
      return const NotificationPrefsPage();
    case 'staticText':
      return StaticTextPage(type: params['type']!);
    case 'servicePackageDetail':
      return ServicePackageDetailPage(packageId: params['id']!);
    case 'dietDetail':
      return DietRecordDetailPage(id: params['id']!);
    default:
      return const LoginPage();
  }
}
