/**
 * The single icon map for the whole app.
 *
 * Astryx resolves exactly 26 SEMANTIC names through the theme's icon registry
 * (`<Icon icon="search" />`). Everything else must be passed as a component.
 * Rather than let feature files import from lucide-react ad hoc — which is how
 * an icon set drifts — every non-semantic glyph is named once, here.
 *
 * Rule: `<Icon icon="search" />` for anything in SEMANTIC_ICONS,
 *       `<Icon icon={ICONS.stores} />` for everything else.
 */

import {
  BadgeCheck,
  Bell,
  BookOpen,
  Building2,
  CalendarClock,
  ChartLine,
  ChevronsUpDown,
  CircleAlert,
  CircleHelp,
  Clock,
  Code,
  Coins,
  Columns3,
  CreditCard,
  Download,
  Expand,
  Footprints,
  Gift,
  Globe,
  History,
  IndianRupee,
  Info,
  Keyboard,
  LayoutDashboard,
  Lock,
  LogOut,
  Maximize2,
  Menu,
  MessageSquare,
  Mic,
  Minimize2,
  PanelLeftClose,
  PanelLeftOpen,
  PanelRightClose,
  PanelRightOpen,
  Paperclip,
  Plus,
  Percent,
  Plug,
  Send,
  Settings,
  ShieldCheck,
  Shrink,
  ShoppingCart,
  Sliders,
  Square,
  SquarePen,
  Sparkles,
  Store,
  TrendingDown,
  TrendingUp,
  Trophy,
  User,
  UserCheck,
  Users,
  UserX,
} from 'lucide-react';
import type {IconType} from '@astryxdesign/core/Icon';

export const ICONS = {
  // Expansion & Resize
  expand: Expand,
  restore: Shrink,
  fullscreen: Maximize2,
  minimize: Minimize2,
  // Navigation
  dashboard: LayoutDashboard,
  commerce: ShoppingCart,
  stores: Store,
  lyts: Gift,
  staff: Users,
  settings: Settings,

  // Settings Modules
  business: Building2,
  roles: ShieldCheck,
  integrations: Plug,
  api: Code,
  security: Lock,
  preferences: Sliders,

  // Dashboard metrics
  visitors: Footprints,
  purchases: ShoppingCart,
  revenue: IndianRupee,
  activeRewards: BadgeCheck,
  conversion: Percent,
  lyt: Coins,

  // Dashboard controls
  compare: Columns3,

  // Trend / delta
  up: TrendingUp,
  down: TrendingDown,

  // Loyaly AI
  ai: Sparkles,
  analytics: ChartLine,
  chat: MessageSquare,
  mic: Mic,
  send: Send,
  panelClose: PanelRightClose,
  panelOpen: PanelRightOpen,
  newChat: SquarePen,
  history: History,
  attach: Paperclip,
  plus: Plus,
  stop: Square,

  // Shell
  // One control drives the sidebar in all three states, so it needs all three
  // glyphs: the hamburger below the drawer breakpoint, and the panel pair
  // above it. PanelLeft*, not PanelRight* — those belong to the Loyaly AI rail
  // on the opposite edge, and pointing both controls the same way would make
  // the header read as two buttons for one panel.
  menu: Menu,
  sidebarOpen: PanelLeftOpen,
  sidebarClose: PanelLeftClose,
  notifications: Bell,

  // Account menu
  language: Globe,
  help: CircleHelp,
  billing: CreditCard,
  download: Download,
  profile: User,
  signOut: LogOut,
  switcher: ChevronsUpDown,
  // Help panel. `info` duplicates a semantic name on purpose: the account menu
  // config types its icons as components, so it cannot pass the string form.
  docs: BookOpen,
  keyboard: Keyboard,
  info: Info,
  sessions: Clock,

  // Staff / rewards
  present: UserCheck,
  absent: UserX,
  late: Clock,
  leaderboard: Trophy,
  expiry: CalendarClock,
  alert: CircleAlert,
} satisfies Record<string, IconType>;

export type IconKey = keyof typeof ICONS;

/**
 * The names that resolve through the theme registry. Prefer these over an
 * equivalent lucide import so the icon follows the theme.
 */
export const SEMANTIC_ICONS = [
  'close',
  'chevronDown',
  'chevronLeft',
  'chevronRight',
  'check',
  'success',
  'error',
  'warning',
  'info',
  'calendar',
  'clock',
  'externalLink',
  'menu',
  'moreHorizontal',
  'search',
  'arrowUp',
  'arrowDown',
  'arrowsUpDown',
  'funnel',
  'eyeSlash',
  'viewColumns',
  'copy',
  'checkDouble',
  'wrench',
  'stop',
  'microphone',
] as const;
