import 'package:flutter/material.dart';

/// Widget for displaying various empty states in the taxi screen
class TaxiEmptyStateWidget extends StatelessWidget {
  final String title;
  final String message;
  final IconData icon;
  final String? buttonText;
  final VoidCallback? onButtonPressed;

  const TaxiEmptyStateWidget({
    super.key,
    required this.title,
    required this.message,
    required this.icon,
    this.buttonText,
    this.onButtonPressed,
  });

  /// Empty state when no filters are selected
  factory TaxiEmptyStateWidget.noFiltersSelected() {
    return const TaxiEmptyStateWidget(
      title: 'Select Filters',
      message: 'Choose a corregimiento and/or shift to see available taxis.',
      icon: Icons.filter_list,
    );
  }

  /// Empty state when no results match the current filters
  factory TaxiEmptyStateWidget.noResultsFound({
    required VoidCallback onClearFilters,
  }) {
    return TaxiEmptyStateWidget(
      title: 'No taxis available for this selection.',
      message: 'Try adjusting your filters or search terms.',
      icon: Icons.search_off,
      buttonText: 'Clear Filters',
      onButtonPressed: onClearFilters,
    );
  }

  /// Empty state when there's no data at all
  factory TaxiEmptyStateWidget.noData() {
    return const TaxiEmptyStateWidget(
      title: 'No taxis registered yet.',
      message: 'There are no taxi services available at the moment.',
      icon: Icons.local_taxi,
    );
  }

  /// Empty state for error conditions
  factory TaxiEmptyStateWidget.error({
    required String error,
    required VoidCallback onRetry,
  }) {
    return TaxiEmptyStateWidget(
      title: 'Error Loading Taxis',
      message: error,
      icon: Icons.error_outline,
      buttonText: 'Retry',
      onButtonPressed: onRetry,
    );
  }

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);

    return Center(
      child: Padding(
        padding: const EdgeInsets.all(32),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(icon, size: 80, color: theme.iconTheme.color?.withAlpha(128)),
            const SizedBox(height: 24),
            Text(
              title,
              style: theme.textTheme.headlineSmall?.copyWith(
                color: const Color(0xFF101820),
                fontWeight: FontWeight.bold,
              ),
              textAlign: TextAlign.center,
            ),
            const SizedBox(height: 12),
            Text(
              message,
              style: theme.textTheme.bodyMedium?.copyWith(
                color: theme.textTheme.bodyMedium?.color?.withAlpha(153),
              ),
              textAlign: TextAlign.center,
            ),
            if (buttonText != null && onButtonPressed != null) ...[
              const SizedBox(height: 24),
              ElevatedButton(
                onPressed: onButtonPressed,
                style: ElevatedButton.styleFrom(
                  backgroundColor: const Color(0xFFFEE715),
                  foregroundColor: const Color(0xFF101820),
                  padding: const EdgeInsets.symmetric(
                    horizontal: 24,
                    vertical: 12,
                  ),
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(8),
                  ),
                ),
                child: Text(buttonText!),
              ),
            ],
          ],
        ),
      ),
    );
  }
}
