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

interface Props {
  environment?: string;
  size?: "sm" | "md";
}

export function EnvironmentBadge({ environment, size = "sm" }: Props) {
  const env = getEnvironment(environment);
  if (!env) return null;

  return (
    <span
      className={cn(
        "inline-flex items-center rounded border font-semibold uppercase leading-none",
        env.bgClass,
        env.textClass,
        env.borderClass,
        size === "sm" ? "px-1.5 py-0.5 text-[10px]" : "px-2 py-0.5 text-xs"
      )}
    >
      {env.label}
    </span>
  );
}
