import {
    Target, CheckCircle, Link, PenTool, Megaphone, Coins, Magnet, Building2, MessageSquare, Star, Newspaper, Lightbulb, Search, ClipboardList, Mic, Mail, Snowflake, Undo2, Package, BookOpen, Briefcase, HelpCircle, FileText, BarChart3, Twitter, Camera, RefreshCw, Smartphone, Hash, Calendar, Bot, Palette, Brain, Image, Sparkles, Code, GitFork, Zap, Clapperboard, Video, Brush, FlaskConical, Handshake, Puzzle, Tv, Telescope, Map, Settings, DoorOpen, Calculator, Flame, Rocket, Trophy, Heart, TrendingUp, Layers, User, Play, Music, Home, Hand, Gamepad, Book, Type, MousePointerClick, Dices, MessageCircle, PencilRuler, Gem, Feather, Stamp, Swords, Waves, Shuffle, Sprout, Wind, Crown, LucideIcon
} from 'lucide-react'

export type IconName =
    | 'Target' | 'CheckCircle' | 'Link' | 'PenTool' | 'Megaphone' | 'Coins' | 'Magnet' | 'Building2' | 'MessageSquare' | 'Star' | 'Newspaper' | 'Lightbulb' | 'Search' | 'ClipboardList' | 'Mic' | 'Mail' | 'Snowflake' | 'Undo2' | 'Package' | 'BookOpen' | 'Briefcase' | 'HelpCircle' | 'FileText' | 'BarChart3' | 'Twitter' | 'Camera' | 'RefreshCw' | 'Smartphone' | 'Hash' | 'Calendar' | 'Bot' | 'Palette' | 'Brain' | 'Image' | 'Sparkles' | 'Code' | 'GitFork' | 'Zap' | 'Clapperboard' | 'Video' | 'Brush' | 'FlaskConical' | 'Handshake' | 'Puzzle' | 'Tv' | 'Telescope' | 'Map' | 'Settings' | 'DoorOpen' | 'Calculator' | 'Flame' | 'Rocket' | 'Trophy' | 'Heart' | 'TrendingUp' | 'Layers' | 'User' | 'Play' | 'Music' | 'Home' | 'Hand' | 'Gamepad' | 'Book' | 'Type' | 'MousePointerClick' | 'Dices' | 'MessageCircle' | 'PencilRuler' | 'Gem' | 'Feather' | 'Stamp' | 'Swords' | 'Waves' | 'Shuffle' | 'Sprout' | 'Wind' | 'Crown'

// Map supports both PascalCase and kebab-case
export const iconMap: Record<string, LucideIcon> = {
    Target, CheckCircle, Link, PenTool, Megaphone, Coins, Magnet, Building2, MessageSquare, Star, Newspaper, Lightbulb, Search, ClipboardList, Mic, Mail, Snowflake, Undo2, Package, BookOpen, Briefcase, HelpCircle, FileText, BarChart3, Twitter, Camera, RefreshCw, Smartphone, Hash, Calendar, Bot, Palette, Brain, Image, Sparkles, Code, GitFork, Zap, Clapperboard, Video, Brush, FlaskConical, Handshake, Puzzle, Tv, Telescope, Map, Settings, DoorOpen, Calculator, Flame, Rocket, Trophy, Heart, TrendingUp, Layers, User, Play, Music, Home, Hand, Gamepad, Book, Type, MousePointerClick, Dices, MessageCircle, PencilRuler, Gem, Feather, Stamp, Swords, Waves, Shuffle, Sprout, Wind, Crown,
    // kebab-case aliases
    'check-circle': CheckCircle,
    'clipboard-list': ClipboardList,
    'zap': Zap,
    'heart': Heart,
    'flame': Flame,
    'shuffle': Shuffle,
    'star': Star,
    'rocket': Rocket,
    'gem': Gem,
    'sprout': Sprout,
}

interface DynamicIconProps {
    name: string
    className?: string
}

export function DynamicIcon({ name, className }: DynamicIconProps) {
    const IconComponent = iconMap[name] || HelpCircle // Fallback icon

    return <IconComponent className={className} />
}
