/**
 * Inline SVG icons for Nexus V2
 * All stroke-based, currentColor, viewBox 0 0 24 24
 */
export const icons: Record<string, string> = {
  grid: `<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>`,
  cpu: `<rect x="5" y="5" width="14" height="14" rx="2"/><rect x="9" y="9" width="6" height="6" rx="1"/><path d="M9 2v3M15 2v3M9 19v3M15 19v3M2 9h3M2 15h3M19 9h3M19 15h3"/>`,
  list: `<path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"/>`,
  flow: `<circle cx="6" cy="6" r="2.5"/><circle cx="18" cy="6" r="2.5"/><circle cx="12" cy="18" r="2.5"/><path d="M7.5 7.5 11 16M16.5 7.5 13 16"/>`,
  brain: `<path d="M9 3a3 3 0 0 0-3 3 3 3 0 0 0-1 5.8A3 3 0 0 0 8 17a3 3 0 0 0 4 1 3 3 0 0 0 4-1 3 3 0 0 0 3-5.2A3 3 0 0 0 18 6a3 3 0 0 0-3-3 3 3 0 0 0-3 1.5A3 3 0 0 0 9 3Z"/>`,
  doc: `<path d="M14 3v5h5M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>`,
  search: `<circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/>`,
  server: `<rect x="3" y="4" width="18" height="7" rx="2"/><rect x="3" y="13" width="18" height="7" rx="2"/><path d="M7 7.5h.01M7 16.5h.01"/>`,
  model: `<path d="M12 2 3 7l9 5 9-5-9-5ZM3 12l9 5 9-5M3 17l9 5 9-5"/>`,
  activity: `<path d="M3 12h4l3 8 4-16 3 8h4"/>`,
  coin: `<circle cx="12" cy="12" r="9"/><path d="M12 7v10M9.5 9.5h4a1.5 1.5 0 0 1 0 3h-3a1.5 1.5 0 0 0 0 3h4"/>`,
  shield: `<path d="M12 3 5 6v5c0 4 3 7 7 9 4-2 7-5 7-9V6z"/>`,
  alert: `<path d="M12 3 2 20h20zM12 9v5M12 17h.01"/>`,
  send: `<path d="M22 2 11 13M22 2 15 22l-4-9-9-4z"/>`,
  spark: `<path d="M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5 18 18M18 6l-2.5 2.5M8.5 15.5 6 18"/>`,
  expand: `<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>`,
  bot: `<rect x="4" y="7" width="16" height="12" rx="3"/><path d="M12 7V4M9 13h.01M15 13h.01M8 19v2M16 19v2"/>`,
  clock: `<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>`,
  target: `<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="5"/><circle cx="12" cy="12" r="1.5"/>`,
  arrow: `<path d="M5 12h14M13 6l6 6-6 6"/>`,
  plus: `<path d="M12 5v14M5 12h14"/>`,
  command: `<path d="M7 4a3 3 0 0 0-3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3V7a3 3 0 0 0-3-3H7z"/><path d="M12 8v8M8 12h8"/>`,
  chevron_left: `<path d="m15 18-6-6 6-6"/>`,
  chevron_right: `<path d="m9 18 6-6-6-6"/>`,
  dots: `<circle cx="12" cy="12" r="1.5"/><circle cx="19" cy="12" r="1.5"/><circle cx="5" cy="12" r="1.5"/>`,
}

export function svg(name: string, cls = ''): string {
  const inner = icons[name]
  if (!inner) return ''
  return `<svg class="${cls}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${inner}</svg>`
}

export interface NavItemDef {
  icon: string
  label: string
  route?: string
  count?: string
  active?: boolean
}

export interface NavGroupDef {
  group: string
  items: NavItemDef[]
}

/**
 * Navigation structure matching NEXUS.nav from agents.js
 */
export const navigation: NavGroupDef[] = [
  {
    group: 'Operations',
    items: [
      { icon: 'grid', label: 'Dashboard', route: '/dashboard', active: true },
      { icon: 'cpu', label: 'Agenten', route: '/agents' },
      { icon: 'list', label: 'Task Board', route: '/tasks' },
      { icon: 'flow', label: 'Orchestrierung', route: '/orchestration' },
    ],
  },
  {
    group: 'Knowledge',
    items: [
      { icon: 'brain', label: 'Memory', route: '/memory' },
      { icon: 'doc', label: 'Docs & .md', route: '/docs' },
      { icon: 'search', label: 'Research', route: '/research' },
    ],
  },
  {
    group: 'Infrastructure',
    items: [
      { icon: 'server', label: 'Hosts · OpenClaw', route: '/hosts' },
      { icon: 'model', label: 'Modelle', route: '/models' },
      { icon: 'activity', label: 'Activity Log', route: '/activity' },
    ],
  },
  {
    group: 'Governance',
    items: [
      { icon: 'coin', label: 'Kosten & Tokens', route: '/costs' },
      { icon: 'shield', label: 'Security', route: '/security' },
      { icon: 'alert', label: 'Incidents', route: '/incidents' },
    ],
  },
]
