import { FraBadge } from "./fra-primitives";

/**
 * LEIS-1055 — "With support". Shown wherever a booking appears while leisure.com support is
 * working on a change or cancellation for it: the My requests card and details, the home page,
 * the approval queue row and the review overlay.
 *
 * The booking's own status stays Booked the whole time, so this is a second label beside it, not
 * a replacement. Draws nothing once support is done, which is how the label "goes away" when
 * support finishes: the server flips `supportStatus` and every screen follows.
 */
export function SupportBadge({
  status,
  reference,
  className,
}: {
  status: "NONE" | "WITH_SUPPORT" | "DONE" | undefined;
  reference?: string | null;
  className?: string;
}) {
  if (status !== "WITH_SUPPORT") return null;
  return (
    <FraBadge tone="info" className={className}>
      With support{reference ? ` · ${reference}` : ""}
    </FraBadge>
  );
}

/** The sentence under the badge: what "with support" means for the person looking at it. */
export function supportExplainer(kind?: "change" | "cancellation"): string {
  const what = kind ?? "change or cancellation";
  return `leisure.com support is working on your ${what}. Updates come by email.`;
}
