import 'package:flutter/material.dart';

class MobileBottomNavigation extends StatelessWidget {
  final int? selectedIndex;
  final Function(int) onItemTapped;

  const MobileBottomNavigation({
    super.key,
    required this.selectedIndex,
    required this.onItemTapped,
    required String currentRoute,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      padding: const EdgeInsets.symmetric(vertical: 8),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          _buildBottomNavItem(
            icon: Icons.table_restaurant,
            label: 'Tables',
            index: 0,
          ),
          _buildBottomNavItem(
            icon: Icons.receipt_long_outlined,
            label: 'Commandes',
            index: 1,
          ),
        ],
      ),
    );
  }

  Widget _buildBottomNavItem({
    required IconData icon,
    required String label,
    required int index,
  }) {
    final isSelected = selectedIndex == index;

    return GestureDetector(
      onTap: () => onItemTapped(index),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Icon(
            icon,
            color: isSelected ? Colors.green.shade700 : Colors.grey.shade600,
            size: 24,
          ),
          const SizedBox(height: 4),
          Text(
            label,
            style: TextStyle(
              color: isSelected ? Colors.green.shade700 : Colors.grey.shade600,
              fontSize: 12,
              fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
            ),
          ),
        ],
      ),
    );
  }
}
