/**
 * Centralized icon registry for consistent icon usage across the application.
 * This ensures that the same concept (e.g., "Opportunities", "Analysis") always
 * uses the same icon throughout the UI.
 */

import {
  BarChart3,
  Briefcase,
  Lightbulb,
  MessageSquare,
  Sparkles,
  TrendingUp,
  Copy,
  Globe,
  Smartphone,
  Clock,
  Link2,
  Home,
  User,
  Key,
  Shield,
  Radio,
  CreditCard,
  AlertCircle,
  CheckCircle2,
  Save,
} from 'lucide-react';
import type { LucideIcon } from 'lucide-react';

/**
 * Icon aliases - maps concept names to specific Lucide icons.
 * Update this object to change icons globally across the app.
 */
export const ICON_REGISTRY: Record<string, LucideIcon> = {
  // Analysis and data
  analysis: BarChart3,
  chart: BarChart3,
  insights: BarChart3,

  // Opportunities - using Sparkles for discovery/suggestions
  opportunities: Sparkles,
  suggestions: Sparkles,
  discovery: Sparkles,

  // Impact and recommendations
  recommendations: Lightbulb,
  impact: TrendingUp,
  performance: TrendingUp,

  // Content and structure
  cannibalization: Copy,
  duplication: Copy,

  // Geographic data
  geographic: Globe,
  location: Globe,
  countries: Globe,

  // Device data
  device: Smartphone,
  mobile: Smartphone,
  responsive: Smartphone,

  // Scheduling
  schedule: Clock,
  calendar: Clock,
  time: Clock,

  // Connections
  connections: Link2,
  integrations: Link2,
  api: Link2,

  // Portfolio
  portfolio: Briefcase,

  // Feedback
  featureRequests: MessageSquare,
  feedback: MessageSquare,

  // User and settings
  dashboard: Home,
  profile: User,
  account: User,
  tokens: Key,
  apiTokens: Key,
  security: Shield,
  webhooks: Radio,
  billing: CreditCard,

  // Status indicators
  error: AlertCircle,
  success: CheckCircle2,
  saving: Save,
};

/**
 * Get an icon by concept name. Falls back to the Sparkles icon if not found.
 * @param conceptName - The concept name (e.g., "opportunities", "analysis")
 * @returns The corresponding Lucide icon component
 */
export function getIcon(conceptName: string): LucideIcon {
  const normalizedName = conceptName.toLowerCase().replace(/\s+/g, '');
  return ICON_REGISTRY[normalizedName] ?? Sparkles;
}
