/**
 * Icon sets, brand glyph paths, and semantic icon-usage slots for the theme engine.
 *
 * @countermeasure-platform/web-components/services/theme-engine
 */

import type { IconSet, IconSetId, IconUsage } from './types'

export const ICON_SETS: Record<IconSetId, IconSet> = {
  lucide: {
    id: 'lucide',
    label: 'Lucide',
    description: 'Default — clean 2px stroke',
    strokeWidth: 2,
    linecap: 'round',
    linejoin: 'round',
    brand: false,
  },
  heroicons: {
    id: 'heroicons',
    label: 'Heroicons',
    description: 'Heavier 2.4px stroke',
    strokeWidth: 2.4,
    linecap: 'round',
    linejoin: 'round',
    brand: false,
  },
  phosphor: {
    id: 'phosphor',
    label: 'Phosphor',
    description: 'Lighter 1.5px stroke',
    strokeWidth: 1.5,
    linecap: 'round',
    linejoin: 'round',
    brand: false,
  },
  material: {
    id: 'material',
    label: 'Material',
    description: 'Square caps, geometric',
    strokeWidth: 2,
    linecap: 'square',
    linejoin: 'miter',
    brand: false,
  },
  countermeasure: {
    id: 'countermeasure',
    label: 'CounterMeasure',
    description: 'Brand set — bespoke marks for security',
    strokeWidth: 1.75,
    linecap: 'round',
    linejoin: 'round',
    brand: true,
  },
}

/** Brand glyph paths — used when `iconSet === 'countermeasure'`. */
export const CM_ICON_PATHS: Record<string, string> = {
  // Shields & security
  Shield: 'M12 2l9 4-3 11-6 5-6-5-3-11z M12 7v10 M7.5 10l9 4 M16.5 10l-9 4',
  ShieldCheck: 'M12 2l9 4-3 11-6 5-6-5-3-11z M8.5 12l3 3 4-5',
  Crosshair:
    'M12 2l9 5v10l-9 5-9-5V7z M12 7l5 5-5 5-5-5z M22 12h-2 M4 12H2 M12 4V2 M12 22v-2 M12 12v.01',
  Target: 'M12 2l9 5v10l-9 5-9-5V7z M12 7l5 5-5 5-5-5z M12 10l2 2-2 2-2-2z',
  Lock: 'M5 11h14v10H5z M8 11V7l4-5 4 5v4 M12 15l1 2h-2z',
  KeyRound: 'M16 2l5 5-3 3-2-1-2 2-1-1-2 2H9v-2l7-8z M9 13v4h3',
  Eye: 'M2 12l4-6h12l4 6-4 6H6z M12 9l3 3-3 3-3-3z',

  // Status — hexagonal frames
  CircleCheck: 'M12 2l9 5v10l-9 5-9-5V7z M9 12l2 2 4-4',
  CircleX: 'M12 2l9 5v10l-9 5-9-5V7z M9 9l6 6 M15 9l-6 6',
  CircleAlert: 'M12 2l9 5v10l-9 5-9-5V7z M12 8v5 M12 16h.01',
  TriangleAlert: 'M12 2l10 18H2z M12 9v5 M12 17h.01',

  // Threat & intel
  Bug: 'M12 3l4 5h-8z M12 8v13 M5 12l-2 2 2 2 M19 12l2 2-2 2 M8 21h8',
  Skull: 'M12 3l8 7v6l-3 3v3h-2v-3h-2v3h-2v-3h-2v3H7v-3l-3-3v-6z M9 12h.01 M15 12h.01',
  Radar: 'M12 2l10 10-10 10L2 12z M12 7l5 5-5 5-5-5z M12 12v.01',
  Siren: 'M7 18l3-6h4l3 6z M12 2v4 M5 7l2 3 M19 7l-2 3 M4 21h16',

  // Data & infrastructure
  Database: 'M4 4h16v5H4z M4 9.5h16v5H4z M4 15h16v5H4z M9 6.5h.01 M9 12h.01 M9 17.5h.01',
  Server: 'M3 3h18v7H3z M3 14h18v7H3z M7 6.5h.01 M7 17.5h.01 M17 6.5h-4 M17 17.5h-4',
  Network: 'M9 2h6v5H9z M3 17h6v5H3z M15 17h6v5h-6z M12 7v4 M6 17v-3l6-3 6 3v3',
  Globe: 'M12 2l9 5v10l-9 5-9-5V7z M12 2v20 M3 7l9 5 9-5 M3 17l9-5 9 5',

  // Navigation & actions
  Search: 'M11 4l5 3v6l-5 3-5-3V7z M20 21l-4-4',
  Plus: 'M12 5v14 M5 12h14',
  X: 'M6 6l12 12 M18 6L6 18',
  ChevronDown: 'M5 9l7 7 7-7',
  ChevronRight: 'M9 5l7 7-7 7',
  Maximize2: 'M15 3h6v6 M3 15v6h6 M21 3l-7 7 M3 21l7-7',
  ArrowUpRight: 'M7 7h10v10 M7 17L17 7',
  Download: 'M12 3v13 M6 11l6 6 6-6 M4 21h16',
  RefreshCw: 'M4 8h4V4 M20 16h-4v4 M8 4l8 0 4 4 M16 20l-8 0-4-4',
  LogOut: 'M14 3h5v18h-5 M3 12h12 M11 8l4 4-4 4',
  PanelLeftClose: 'M3 3h18v18H3z M9 3v18 M16 15l-3-3 3-3',

  // Connectors & workflow
  Plug: 'M12 2l4 4-4 4-4-4z M12 10v4 M9 14h6v3l-3 4-3-4z',
  Workflow: 'M3 3h6v6H3z M15 15h6v6h-6z M21 3h-6v6h6z M6 9v3l6 3 6-3V9',
  GitBranch: 'M6 3v12 M18 3v6 M6 18l3-3h6l3-3',

  // Files & content
  FileCode2: 'M6 2h8l5 5v14H6V2z M14 2v5h5 M10 13l-2 2 2 2 M14 13l2 2-2 2',
  FileText: 'M6 2h8l5 5v14H6V2z M14 2v5h5 M9 13h6 M9 17h4',
  Folder: 'M2 7l2-4h7l2 2h7l2 2v13H2z',
  BookOpen: 'M2 3h8l2 2 2-2h8v16h-8l-2 2-2-2H2z M12 5v16',
  Tag: 'M2 4h9l10 8-6 6-10-8V4z M6 8h.01',
  Package: 'M12 2l9 5v10l-9 5-9-5V7z M12 12l9-5 M12 12v10 M12 12L3 7',
  Boxes: 'M2 7l5-3 5 3v6l-5 3-5-3z M12 7l5-3 5 3v6l-5 3-5-3z M7 13l5 3 5-3',

  // Analytics & data viz
  BarChart3: 'M3 3v18h18 M8 21v-7 M13 21V8 M18 21v-4',
  Gauge: 'M4 19l4-7 4 2 4-9 4 3 M2 21h20',
  ListFilter: 'M2 5h20 M6 12h12 M9 19h6',
  Grid3X3: 'M2 2h20v20H2z M2 9h20 M2 16h20 M9 2v20 M16 2v20',
  LayoutGrid: 'M3 3h8v8H3z M13 3h8v8h-8z M3 13h8v8H3z M13 13h8v8h-8z',

  // Tools & settings
  Settings:
    'M12 2l1.5 2.6L16 4l.5 3 3 .5L19 10l2.6 1.5L20 14l1 3-3 1-1 3-3-1-1.5 2.6L11 20l-1 2-3-1L6 18l-3-1 1-3-2.6-1.5L4 11 2 9.5 5 8l-1-3 3-1z M12 9l3 3-3 3-3-3z',
  Cog: 'M12 2v2 M12 20v2 M4.93 4.93l1.41 1.41 M17.66 17.66l1.41 1.41 M2 12h2 M20 12h2 M4.93 19.07l1.41-1.41 M17.66 6.34l1.41-1.41 M12 8l4 4-4 4-4-4z',

  // Objects & concepts
  Lightbulb: 'M12 3l5 6-5 8-5-8z M9 18h6 M10 21h4',
  Sparkles: 'M12 2l3 7 7 3-7 3-3 7-3-7-7-3 7-3z',
  Rocket: 'M12 2l5 8h-3v8h-4v-8H7z M9 22h6',
  Activity: 'M2 12h4l3 8 3-16 3 8 3-4h4',
  Layers: 'M12 2l10 5-10 5L2 7z M2 12l10 5 10-5 M2 17l10 5 10-5',
  Sun: 'M12 6l5 3v6l-5 3-5-3V9z M12 2v2 M12 20v2 M4 4l1.5 1.5 M18.5 18.5L20 20 M2 12h2 M20 12h2 M4 20l1.5-1.5 M18.5 5.5L20 4',
  Clock: 'M12 2l9 5v10l-9 5-9-5V7z M12 7v5l3 3',
  History: 'M12 2l9 5v10l-9 5-9-5V7z M12 7v5l3 2 M3 4l1 4h3',

  // People & places
  Users: 'M8 10l4 3-4 3V10z M14 7l4 3-4 3V7z M4 21v-2l4-2 4 2 4-2 4 2v2',
  Building2: 'M6 22V4l6-2 6 2v18 M2 22h20 M10 8h4 M10 12h4 M10 16h4',

  // Code & dev
  Code2: 'M8 4L2 12l6 8 M16 4l6 8-6 8',
}

/** Semantic icon-usage slots driving the per-icon override matrix. */
export const ICON_USAGES: IconUsage[] = [
  {
    id: 'nav.search',
    label: 'Search',
    defaultIcon: 'Search',
    alternates: ['Search', 'Crosshair', 'Target'],
  },
  {
    id: 'nav.notifications',
    label: 'Notifications',
    defaultIcon: 'Bell',
    alternates: ['Bell', 'AlertCircle', 'Activity'],
  },
  {
    id: 'nav.help',
    label: 'Help',
    defaultIcon: 'HelpCircle',
    alternates: ['HelpCircle', 'BookOpen', 'MessageSquare'],
  },
  {
    id: 'nav.feedback',
    label: 'Feedback',
    defaultIcon: 'MessageSquare',
    alternates: ['MessageSquare', 'Send', 'Mic'],
  },
  {
    id: 'product.detection',
    label: 'Detection',
    defaultIcon: 'Shield',
    alternates: ['Shield', 'ShieldCheck', 'Bug', 'AlertTriangle'],
  },
  {
    id: 'product.coverage',
    label: 'Coverage',
    defaultIcon: 'Crosshair',
    alternates: ['Crosshair', 'Target', 'Grid3X3'],
  },
  {
    id: 'product.intel',
    label: 'Threat intel',
    defaultIcon: 'Skull',
    alternates: ['Skull', 'Bug', 'AlertTriangle'],
  },
  {
    id: 'product.connectors',
    label: 'Connectors',
    defaultIcon: 'Plug',
    alternates: ['Plug', 'Network', 'Workflow'],
  },
  {
    id: 'product.detections',
    label: 'Detection library',
    defaultIcon: 'FileCode',
    alternates: ['FileCode', 'BookOpen', 'Files'],
  },
  {
    id: 'product.opps',
    label: 'Opportunities',
    defaultIcon: 'Lightbulb',
    alternates: ['Lightbulb', 'Sparkles', 'TrendingUp'],
  },
  {
    id: 'product.studio',
    label: 'Studio (IDE)',
    defaultIcon: 'Terminal',
    alternates: ['Terminal', 'Code2', 'Code'],
  },
  {
    id: 'system.settings',
    label: 'Settings',
    defaultIcon: 'Settings',
    alternates: ['Settings', 'SlidersHorizontal', 'Wrench'],
  },
  {
    id: 'system.user',
    label: 'User',
    defaultIcon: 'UserCheck',
    alternates: ['UserCheck', 'UserCog', 'Users'],
  },
  {
    id: 'system.logout',
    label: 'Sign out',
    defaultIcon: 'LogOut',
    alternates: ['LogOut', 'LogIn'],
  },
  {
    id: 'state.success',
    label: 'Success',
    defaultIcon: 'CheckCircle',
    alternates: ['CheckCircle', 'Check'],
  },
  {
    id: 'state.warning',
    label: 'Warning',
    defaultIcon: 'AlertTriangle',
    alternates: ['AlertTriangle', 'AlertCircle'],
  },
]
