import 'package:design_system/design_system.dart';
import 'package:flutter/widgets.dart';

/// Metadata for styling order type cards based on their ID.
class OrderTypeUiMetadata {
  /// Creates an [OrderTypeUiMetadata].
  const OrderTypeUiMetadata({
    required this.icon,
    required this.backgroundColor,
    required this.borderColor,
    required this.iconBackgroundColor,
    required this.iconColor,
    required this.textColor,
    required this.descriptionColor,
  });

  /// Factory to get metadata based on order type ID.
  factory OrderTypeUiMetadata.fromId({required String id}) {
    switch (id) {
      case 'rapid':
        return const OrderTypeUiMetadata(
          icon: UiIcons.zap,
          backgroundColor: UiColors.tagPending,
          borderColor: UiColors.separatorSpecial,
          iconBackgroundColor: UiColors.textWarning,
          iconColor: UiColors.white,
          textColor: UiColors.textWarning,
          descriptionColor: UiColors.textWarning,
        );
      case 'one-time':
        return const OrderTypeUiMetadata(
          icon: UiIcons.calendar,
          backgroundColor: UiColors.tagInProgress,
          borderColor: UiColors.primaryInverse,
          iconBackgroundColor: UiColors.primary,
          iconColor: UiColors.white,
          textColor: UiColors.textLink,
          descriptionColor: UiColors.textLink,
        );
      case 'recurring':
        return const OrderTypeUiMetadata(
          icon: UiIcons.rotateCcw,
          backgroundColor: UiColors.tagSuccess,
          borderColor: UiColors.switchActive,
          iconBackgroundColor: UiColors.textSuccess,
          iconColor: UiColors.white,
          textColor: UiColors.textSuccess,
          descriptionColor: UiColors.textSuccess,
        );
      case 'permanent':
        return const OrderTypeUiMetadata(
          icon: UiIcons.briefcase,
          backgroundColor: UiColors.tagRefunded,
          borderColor: UiColors.primaryInverse,
          iconBackgroundColor: UiColors.primary,
          iconColor: UiColors.white,
          textColor: UiColors.textLink,
          descriptionColor: UiColors.textLink,
        );
      default:
        return const OrderTypeUiMetadata(
          icon: UiIcons.help,
          backgroundColor: UiColors.bgSecondary,
          borderColor: UiColors.border,
          iconBackgroundColor: UiColors.iconSecondary,
          iconColor: UiColors.white,
          textColor: UiColors.textPrimary,
          descriptionColor: UiColors.textSecondary,
        );
    }
  }

  /// Icon for the order type.
  final IconData icon;

  /// Background color for the card.
  final Color backgroundColor;

  /// Border color for the card.
  final Color borderColor;

  /// Background color for the icon.
  final Color iconBackgroundColor;

  /// Color for the icon.
  final Color iconColor;

  /// Color for the title text.
  final Color textColor;

  /// Color for the description text.
  final Color descriptionColor;
}
