import 'package:flutter/material.dart';
import 'theme/app_colors.dart';
import '../features/dashboard/presentation/pages/issuer_dashboard_page.dart';
import '../features/coupon_management/presentation/pages/coupon_list_page.dart';
import '../features/redemption/presentation/pages/redemption_page.dart';
import '../features/finance/presentation/pages/finance_page.dart';
import '../features/settings/presentation/pages/settings_page.dart';

/// 发行方主导航Shell
///
/// 底部5Tab：数据概览 / 券管理 / 核销 / 财务 / 我的
class IssuerMainShell extends StatefulWidget {
  const IssuerMainShell({super.key});

  @override
  State<IssuerMainShell> createState() => _IssuerMainShellState();
}

class _IssuerMainShellState extends State<IssuerMainShell> {
  int _currentIndex = 0;

  final _pages = const [
    IssuerDashboardPage(),
    CouponListPage(),
    RedemptionPage(),
    FinancePage(),
    SettingsPage(),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: IndexedStack(
        index: _currentIndex,
        children: _pages,
      ),
      bottomNavigationBar: NavigationBar(
        selectedIndex: _currentIndex,
        onDestinationSelected: (index) {
          setState(() => _currentIndex = index);
        },
        destinations: const [
          NavigationDestination(
            icon: Icon(Icons.dashboard_outlined),
            selectedIcon: Icon(Icons.dashboard_rounded),
            label: '数据概览',
          ),
          NavigationDestination(
            icon: Icon(Icons.confirmation_number_outlined),
            selectedIcon: Icon(Icons.confirmation_number_rounded),
            label: '券管理',
          ),
          NavigationDestination(
            icon: Icon(Icons.qr_code_scanner_outlined),
            selectedIcon: Icon(Icons.qr_code_scanner_rounded),
            label: '核销',
          ),
          NavigationDestination(
            icon: Icon(Icons.account_balance_wallet_outlined),
            selectedIcon: Icon(Icons.account_balance_wallet_rounded),
            label: '财务',
          ),
          NavigationDestination(
            icon: Icon(Icons.settings_outlined),
            selectedIcon: Icon(Icons.settings_rounded),
            label: '我的',
          ),
        ],
      ),
    );
  }
}
