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

import '../../domain/order_status.dart';

/// A chip that displays the [OrderStatus] of an order using the
/// design-system [KcStatusChip].
class OrderStatusChip extends StatelessWidget {
  final OrderStatus status;

  const OrderStatusChip({super.key, required this.status});

  @override
  Widget build(BuildContext context) {
    final (label, bg, fg) = _style(status);
    return KcStatusChip(label: label, background: bg, foreground: fg);
  }

  static (String, Color, Color) _style(OrderStatus status) {
    switch (status) {
      case OrderStatus.pending:
        return ('Pending', const Color(0xFFFFF8E1), KcColors.warning);
      case OrderStatus.processing:
        return ('Processing', const Color(0xFFE3F2FD), KcColors.denimBlue);
      case OrderStatus.shipped:
        return ('Shipped', const Color(0xFFE0F7FA), KcColors.deepTeal);
      case OrderStatus.delivered:
        return ('Delivered', const Color(0xFFE8F5E9), KcColors.success);
      case OrderStatus.cancelled:
        return ('Cancelled', const Color(0xFFFFEBEE), KcColors.danger);
    }
  }
}
