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

/// A status chip for an [InventoryStatus] value, using the shared [KcStatusChip].
class InventoryStatusChip extends StatelessWidget {
  final InventoryStatus status;

  const InventoryStatusChip({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(InventoryStatus status) {
    switch (status) {
      case InventoryStatus.inStock:
        return ('In Stock', const Color(0xFFE8F5E9), KcColors.success);
      case InventoryStatus.lowStock:
        return ('Low Stock', const Color(0xFFFFF8E1), KcColors.warning);
      case InventoryStatus.outOfStock:
        return ('Out of Stock', const Color(0xFFFFEBEE), KcColors.danger);
      case InventoryStatus.draft:
        return ('Draft', const Color(0xFFECEFF1), KcColors.neutral);
    }
  }
}
