import {
  Cloud,
  Cpu,
  Database,
  Code2,
  Smartphone,
  Boxes,
  GitBranch,
  ShieldCheck,
  LineChart,
  Rocket,
  Target,
  Eye,
  Compass,
  Building2,
  Landmark,
  HeartPulse,
  Factory,
  GraduationCap,
  ShoppingBag,
  Layers,
  Workflow,
  Users,
  Sparkles,
  Handshake,
  BadgeCheck,
  Search,
  PenTool,
  Hammer,
  RefreshCw,
  TrendingUp,
  Headset,
  type LucideIcon,
} from "lucide-react";

const map: Record<string, LucideIcon> = {
  cloud: Cloud,
  cpu: Cpu,
  database: Database,
  code: Code2,
  mobile: Smartphone,
  boxes: Boxes,
  devops: GitBranch,
  shield: ShieldCheck,
  chart: LineChart,
  rocket: Rocket,
  target: Target,
  eye: Eye,
  compass: Compass,
  building: Building2,
  landmark: Landmark,
  health: HeartPulse,
  factory: Factory,
  education: GraduationCap,
  retail: ShoppingBag,
  layers: Layers,
  workflow: Workflow,
  users: Users,
  sparkles: Sparkles,
  handshake: Handshake,
  badge: BadgeCheck,
  discover: Search,
  design: PenTool,
  build: Hammer,
  modernize: RefreshCw,
  scale: TrendingUp,
  support: Headset,
};

interface IconProps {
  name: string;
  className?: string;
}

/** Renders a named lucide icon. Keeps content data serializable (string keys). */
export function Icon({ name, className = "h-6 w-6" }: IconProps) {
  const Cmp = map[name] ?? Sparkles;
  return <Cmp className={className} strokeWidth={1.6} />;
}
