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

/// A card displaying an example message for a rapid order.
class RapidOrderExampleCard extends StatelessWidget {
  /// Creates a [RapidOrderExampleCard].
  const RapidOrderExampleCard({
    required this.example,
    required this.isHighlighted,
    required this.label,
    required this.onTap,
    super.key,
  });

  /// The example text.
  final String example;

  /// Whether this is the first (highlighted) example.
  final bool isHighlighted;

  /// The label for the example prefix (e.g., "Example:").
  final String label;

  /// Callback when the card is tapped.
  final VoidCallback onTap;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        width: double.infinity,
        padding: const EdgeInsets.symmetric(
          horizontal: UiConstants.space4,
          vertical: UiConstants.space3,
        ),
        decoration: BoxDecoration(
          color: isHighlighted
              ? UiColors.accent.withValues(alpha: 0.15)
              : UiColors.white,
          borderRadius: UiConstants.radiusMd,
          border: Border.all(
            color: isHighlighted ? UiColors.accent : UiColors.border,
          ),
        ),
        child: RichText(
          text: TextSpan(
            style: UiTypography.body2r.textPrimary,
            children: <InlineSpan>[
              TextSpan(text: label, style: UiTypography.body2b.textPrimary),
              TextSpan(text: ' $example'),
            ],
          ),
        ),
      ),
    );
  }
}
