import 'package:flutter/material.dart';
import '../features/auth/presentation/pages/issuer_login_page.dart';
import '../features/onboarding/presentation/pages/onboarding_page.dart';
import '../features/dashboard/presentation/pages/issuer_dashboard_page.dart';
import '../features/coupon_management/presentation/pages/coupon_list_page.dart';
import '../features/coupon_management/presentation/pages/create_coupon_page.dart';
import '../features/coupon_management/presentation/pages/coupon_detail_page.dart';
import '../features/redemption/presentation/pages/redemption_page.dart';
import '../features/finance/presentation/pages/finance_page.dart';
import '../features/credit/presentation/pages/credit_page.dart';
import '../features/ai_agent/presentation/pages/ai_agent_page.dart';
import '../features/settings/presentation/pages/settings_page.dart';
import '../features/store_management/presentation/pages/store_management_page.dart';
import '../app/issuer_main_shell.dart';

/// 发行方App路由配置
class AppRouter {
  static const String splash = '/';
  static const String login = '/login';
  static const String onboarding = '/onboarding';
  static const String main = '/main';
  static const String couponList = '/coupons';
  static const String createCoupon = '/coupons/create';
  static const String couponDetail = '/coupons/detail';
  static const String redemption = '/redemption';
  static const String finance = '/finance';
  static const String credit = '/credit';
  static const String aiAgent = '/ai-agent';
  static const String settings = '/settings';
  static const String storeManagement = '/stores';

  static Route<dynamic> generateRoute(RouteSettings routeSettings) {
    switch (routeSettings.name) {
      case splash:
      case login:
        return MaterialPageRoute(builder: (_) => const IssuerLoginPage());
      case onboarding:
        return MaterialPageRoute(builder: (_) => const OnboardingPage());
      case main:
        return MaterialPageRoute(builder: (_) => const IssuerMainShell());
      case couponList:
        return MaterialPageRoute(builder: (_) => const CouponListPage());
      case createCoupon:
        return MaterialPageRoute(builder: (_) => const CreateCouponPage());
      case couponDetail:
        return MaterialPageRoute(builder: (_) => const IssuerCouponDetailPage());
      case redemption:
        return MaterialPageRoute(builder: (_) => const RedemptionPage());
      case finance:
        return MaterialPageRoute(builder: (_) => const FinancePage());
      case credit:
        return MaterialPageRoute(builder: (_) => const CreditPage());
      case aiAgent:
        return MaterialPageRoute(builder: (_) => const AiAgentPage());
      case settings:
        return MaterialPageRoute(builder: (_) => const SettingsPage());
      case storeManagement:
        return MaterialPageRoute(builder: (_) => const StoreManagementPage());
      default:
        return MaterialPageRoute(
          builder: (_) => Scaffold(
            body: Center(child: Text('Route not found: ${routeSettings.name}')),
          ),
        );
    }
  }
}
