import type { LucideIcon, LucideProps } from "lucide-react";
import {
  Mic,
  PhoneCall,
  MessageCircle,
  MessageSquare,
  MessagesSquare,
  Globe,
  Workflow,
  ShoppingCart,
  ShoppingBag,
  GraduationCap,
  Landmark,
  Banknote,
  HeartPulse,
  Stethoscope,
  ShieldCheck,
  ShieldAlert,
  Umbrella,
  Truck,
  Car,
  Building2,
  Newspaper,
  LifeBuoy,
  Calendar,
  CalendarClock,
  Table2,
  StickyNote,
  Hash,
  Zap,
  Phone,
  Languages,
  Gauge,
  Boxes,
  Users,
  LayoutGrid,
  Repeat,
  Headphones,
  Clock,
  Sparkles,
  Bot,
  Plug,
  Server,
  FileText,
  Lock,
  Search,
  Send,
  Play,
  Mail,
  MapPin,
  ArrowRight,
  ArrowUpRight,
  Check,
  CheckCheck,
  ChevronDown,
  ChevronRight,
  X,
  Menu,
  Sun,
  Moon,
} from "lucide-react";

/**
 * Central icon registry (§5.5) — lucide-react only, consistent 1.5px stroke.
 * Content data files reference an icon by its registered name (a string), so
 * server components never pass icon *components* across the RSC boundary.
 */
export const icons = {
  Mic,
  PhoneCall,
  MessageCircle,
  MessageSquare,
  MessagesSquare,
  Globe,
  Workflow,
  ShoppingCart,
  ShoppingBag,
  GraduationCap,
  Landmark,
  Banknote,
  HeartPulse,
  Stethoscope,
  ShieldCheck,
  ShieldAlert,
  Umbrella,
  Truck,
  Car,
  Building2,
  Newspaper,
  LifeBuoy,
  Calendar,
  CalendarClock,
  Table2,
  StickyNote,
  Hash,
  Zap,
  Phone,
  Languages,
  Gauge,
  Boxes,
  Users,
  LayoutGrid,
  Repeat,
  Headphones,
  Clock,
  Sparkles,
  Bot,
  Plug,
  Server,
  FileText,
  Lock,
  Search,
  Send,
  Play,
  Mail,
  MapPin,
  ArrowRight,
  ArrowUpRight,
  Check,
  CheckCheck,
  ChevronDown,
  ChevronRight,
  X,
  Menu,
  Sun,
  Moon,
} satisfies Record<string, LucideIcon>;

export type IconName = keyof typeof icons;

export function Icon({
  name,
  strokeWidth = 1.5,
  ...props
}: { name: IconName } & LucideProps) {
  const Cmp = icons[name];
  return <Cmp strokeWidth={strokeWidth} aria-hidden {...props} />;
}
