import type { UserRole } from "@prisma/client";

import { cn } from "@/lib/utils";

type RoleBadgeProps = {
  role: UserRole;
  className?: string;
};

const roleLabels: Record<string, string> = {
  SUPERADMIN: "Admin",
  ADMIN: "Vorstand",
  KOORDINATOR: "Koordinator",
  ELTERN: "Eltern",
  ERZIEHER: "Erzieher",
};

export function RoleBadge({ role, className }: RoleBadgeProps) {
  return (
    <span
      className={cn(
        "inline-flex w-fit rounded-full border border-[var(--accent-mid)] bg-[var(--accent-soft)] px-2.5 py-1 text-[10.5px] font-semibold uppercase text-[var(--accent-deep)] [letter-spacing:0.1em]",
        className,
      )}
    >
      {roleLabels[role] ?? role}
    </span>
  );
}
