/**
 * 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,
  Building2,
  CalendarClock,
  ChartLine,
  ChevronsUpDown,
  CircleAlert,
  Clock,
  Code,
  Coins,
  Columns3,
  Footprints,
  Gift,
  IndianRupee,
  LayoutDashboard,
  Lock,
  LogOut,
  Menu,
  MessageSquare,
  Mic,
  PanelLeftClose,
  PanelLeftOpen,
  PanelRightClose,
  PanelRightOpen,
  Percent,
  Plug,
  Send,
  Settings,
  ShieldCheck,
  ShoppingCart,
  Sliders,
  Sparkles,
  Store,
  TrendingDown,
  TrendingUp,
  Trophy,
  User,
  UserCheck,
  Users,
  UserX,
} from 'lucide-react';
import type {IconType} from '@astryxdesign/core/Icon';

export const ICONS = {
  // Navigation
  dashboard: LayoutDashboard,
  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,

  // Copilot
  ai: Sparkles,
  analytics: ChartLine,
  chat: MessageSquare,
  mic: Mic,
  send: Send,
  panelClose: PanelRightClose,
  panelOpen: PanelRightOpen,

  // 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 Copilot 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,
  profile: User,
  signOut: LogOut,
  switcher: ChevronsUpDown,

  // 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;
