import { useTranslation } from "react-i18next";

import type { components } from "../api/schema";
import { Badge } from "@/components/ui/badge";

type Visibility = components["schemas"]["Visibility"];

const VARIANT: Record<Visibility, "secondary" | "warning" | "success"> = {
  draft: "secondary",
  internal: "warning",
  public: "success",
};

export function VisibilityBadge({ visibility }: { visibility: Visibility }) {
  const { t } = useTranslation();

  return (
    <Badge variant={VARIANT[visibility]}>{t(`visibility.${visibility}`)}</Badge>
  );
}
