"use client";

import { Badge } from "@/components/ui";
import { enumLabel, humanizeCommercialCode } from "../presentation";

export function PlanBadge({
  label,
  status,
}: {
  label?: string | null;
  status?: string | null;
}) {
  if (!label && !status) return <Badge variant="default">بدون پلن</Badge>;
  return (
    <Badge variant={status === "active" || status === "trialing" ? "primary" : "default"}>
      {label ? humanizeCommercialCode(label) : enumLabel(status)}
    </Badge>
  );
}

export function CapabilityBadge({ code, label }: { code: string; label?: string }) {
  return (
    <span className="inline-flex items-center rounded-full border border-gray-200 bg-white px-2.5 py-0.5 text-xs text-secondary">
      {humanizeCommercialCode(code, label)}
    </span>
  );
}
