import {
  LayoutDashboard,
  BookOpen,
  Calendar,
  Images,
  Building2,
  Settings,
  Shield,
  Inbox
} from 'lucide-react'

/**
 * Shinkan Navigation Configuration
 * Single source of truth für Bottom-Nav (Mobile) + Desktop-Sidebar
 *
 * @typedef {{ to: string, label: string, shortLabel?: string, end?: boolean, Icon: import('react').ForwardRefExoticComponent }} AppNavItem
 */

/** @param {{ showInbox?: boolean }} opts */
function baseItems(opts = {}) {
  const showInbox = !!opts.showInbox
  const items = [
    { to: '/', label: 'Übersicht', end: true },
    ...(showInbox ? [{ to: '/inbox', label: 'Posteingang', shortLabel: 'Post' }] : []),
    { to: '/exercises', label: 'Übungen', shortLabel: 'Übungen' },
    { to: '/planning', label: 'Planung' },
    { to: '/media', label: 'Medien', shortLabel: 'Medien' },
    { to: '/clubs', label: 'Vereine' },
    { to: '/settings', label: 'Einstellungen', shortLabel: 'Einst.' }
  ]
  return items
}

/** @param {boolean} isAdmin @param {{ showInbox?: boolean }} opts */
export function getMainNavItems(isAdmin, opts = {}) {
  const showInbox = !!opts.showInbox
  const icons = [
    LayoutDashboard,
    ...(showInbox ? [Inbox] : []),
    BookOpen,
    Calendar,
    Images,
    Building2,
    Settings,
  ]

  const raw = baseItems(opts).map((item, i) => ({
    ...item,
    Icon: icons[i]
  }))

  if (isAdmin) {
    raw.push({ to: '/admin', label: 'Admin', end: false, Icon: Shield })
  }

  return raw
}
