"use client";

import { Badge } from "@/components/ui/badge";
import { Shield, ShieldCheck, User } from "lucide-react";

interface RoleBadgeProps {
  role: string;
}

const roleConfig: Record<string, { label: string; variant: "default" | "secondary" | "destructive" | "outline"; icon: React.ReactNode }> = {
  "super-admin": {
    label: "Super Admin",
    variant: "destructive",
    icon: <ShieldCheck className="h-3 w-3 mr-1" />,
  },
  admin: {
    label: "Admin",
    variant: "default",
    icon: <Shield className="h-3 w-3 mr-1" />,
  },
  user: {
    label: "User",
    variant: "secondary",
    icon: <User className="h-3 w-3 mr-1" />,
  },
};

export function RoleBadge({ role }: RoleBadgeProps) {
  const config = roleConfig[role] || {
    label: role,
    variant: "outline" as const,
    icon: <User className="h-3 w-3 mr-1" />,
  };

  return (
    <Badge variant={config.variant} className="flex items-center w-fit">
      {config.icon}
      {config.label}
    </Badge>
  );
}
