import {
  Shield,
  Trophy,
  Flame,
  Zap,
  Star,
  Crown,
  Swords,
  Target,
  type LucideIcon,
} from "lucide-react";

export const TEAM_ICON_OPTIONS = [
  { id: "shield", label: "Shield", Icon: Shield },
  { id: "trophy", label: "Trophy", Icon: Trophy },
  { id: "flame", label: "Flame", Icon: Flame },
  { id: "zap", label: "Bolt", Icon: Zap },
  { id: "star", label: "Star", Icon: Star },
  { id: "crown", label: "Crown", Icon: Crown },
  { id: "swords", label: "Swords", Icon: Swords },
  { id: "target", label: "Target", Icon: Target },
] as const;

export type TeamIconId = (typeof TEAM_ICON_OPTIONS)[number]["id"];

const iconMap: Record<string, LucideIcon> = Object.fromEntries(
  TEAM_ICON_OPTIONS.map((o) => [o.id, o.Icon])
);

export function TeamIcon({
  icon,
  className,
}: {
  icon?: string | null;
  className?: string;
}) {
  const Icon = iconMap[icon ?? "shield"] ?? Shield;
  return <Icon className={className} />;
}
