import { ICONS } from "@/lib/icons";

type CashHealth = "NO_DATA" | "NEGATIVE" | "WARNING" | "SAFE";

const CONFIG: Record<CashHealth, { label: string; className: string }> = {
  NO_DATA: { label: "Chưa đủ dữ liệu — hãy nhập số dư hiện tại", className: "bg-slate-100 text-slate-600 border-slate-200" },
  NEGATIVE: { label: "Nguy cơ âm tiền", className: "bg-rose-50 text-rose-700 border-rose-200" },
  WARNING: { label: "Cảnh báo", className: "bg-amber-50 text-amber-700 border-amber-200" },
  SAFE: { label: "An toàn", className: "bg-emerald-50 text-emerald-700 border-emerald-200" },
};

/** Trạng thái dòng tiền tổng quan (mục A trong yêu cầu) — suy ra trực tiếp từ cảnh báo thật, không tính lại. */
export function CashHealthBadge({ health }: { health: CashHealth }) {
  const cfg = CONFIG[health] ?? CONFIG.NO_DATA;
  return (
    <div className={`inline-flex w-fit items-center gap-2 rounded-lg border px-3 py-2 text-sm font-semibold ${cfg.className}`}>
      <ICONS.wallet size={16} strokeWidth={1.75} />
      Trạng thái dòng tiền: {cfg.label}
    </div>
  );
}
