import * as icon from '@mdi/js'
import { MenuAsideItem } from './interfaces'

const mdi = icon as Record<string, string>
const pickIcon = (name: string, fallback = icon.mdiTable) => mdi[name] || fallback

const menuAside: MenuAsideItem[] = [
  {
    href: '/dashboard',
    icon: icon.mdiViewDashboardOutline,
    label: 'Operasyon Özeti',
  },
  {
    href: '/sales-hub',
    icon: icon.mdiChartTimelineVariant,
    label: 'Satış Merkezi',
  },
  {
    label: 'CRM ve Satış',
    icon: pickIcon('mdiHandshake', icon.mdiTable),
    withDevider: true,
    menu: [
      {
        href: '/companies/companies-list',
        label: 'Şirketler',
        icon: pickIcon('mdiDomain'),
        permissions: 'READ_COMPANIES',
      },
      {
        href: '/contacts/contacts-list',
        label: 'Kişiler',
        icon: pickIcon('mdiCardAccountDetails'),
        permissions: 'READ_CONTACTS',
      },
      {
        href: '/pipelines/pipelines-list',
        label: 'Pipeline\'lar',
        icon: pickIcon('mdiSourceBranch'),
        permissions: 'READ_PIPELINES',
      },
      {
        href: '/pipeline_stages/pipeline_stages-list',
        label: 'Aşamalar',
        icon: pickIcon('mdiSwapHorizontal'),
        permissions: 'READ_PIPELINE_STAGES',
      },
      {
        href: '/leads/leads-list',
        label: 'Potansiyel Müşteriler',
        icon: pickIcon('mdiAccountArrowRight'),
        permissions: 'READ_LEADS',
      },
      {
        href: '/deals/deals-list',
        label: 'Fırsatlar',
        icon: pickIcon('mdiHandshake'),
        permissions: 'READ_DEALS',
      },
      {
        href: '/activities/activities-list',
        label: 'Aktiviteler',
        icon: pickIcon('mdiCalendarCheck'),
        permissions: 'READ_ACTIVITIES',
      },
    ],
  },
  {
    label: 'Üretim ERP',
    icon: pickIcon('mdiFactory', icon.mdiTable),
    menu: [
      {
        href: '/materials/materials-list',
        label: 'Malzemeler',
        icon: pickIcon('mdiCubeOutline'),
        permissions: 'READ_MATERIALS',
      },
      {
        href: '/warehouses/warehouses-list',
        label: 'Depolar',
        icon: pickIcon('mdiWarehouse'),
        permissions: 'READ_WAREHOUSES',
      },
      {
        href: '/inventory_items/inventory_items-list',
        label: 'Stok Kalemleri',
        icon: pickIcon('mdiPackageVariantClosed'),
        permissions: 'READ_INVENTORY_ITEMS',
      },
      {
        href: '/machines/machines-list',
        label: 'Makineler',
        icon: pickIcon('mdiRobotIndustrial'),
        permissions: 'READ_MACHINES',
      },
      {
        href: '/production_orders/production_orders-list',
        label: 'Üretim Emirleri',
        icon: pickIcon('mdiFactory'),
        permissions: 'READ_PRODUCTION_ORDERS',
      },
      {
        href: '/production_operations/production_operations-list',
        label: 'Operasyonlar',
        icon: pickIcon('mdiPlaylistPlay'),
        permissions: 'READ_PRODUCTION_OPERATIONS',
      },
      {
        href: '/quality_inspections/quality_inspections-list',
        label: 'Kalite Kontrolleri',
        icon: pickIcon('mdiClipboardSearch'),
        permissions: 'READ_QUALITY_INSPECTIONS',
      },
      {
        href: '/nonconformances/nonconformances-list',
        label: 'Uygunsuzluklar',
        icon: pickIcon('mdiAlertOctagonOutline'),
        permissions: 'READ_NONCONFORMANCES',
      },
      {
        href: '/vendors/vendors-list',
        label: 'Tedarikçiler',
        icon: pickIcon('mdiTruckFast'),
        permissions: 'READ_VENDORS',
      },
    ],
  },
  {
    label: 'Etkinlik Yönetimi',
    icon: pickIcon('mdiCalendarStar', icon.mdiTable),
    menu: [
      {
        href: '/venues/venues-list',
        label: 'Mekanlar',
        icon: pickIcon('mdiMapMarkerRadius'),
        permissions: 'READ_VENUES',
      },
      {
        href: '/events/events-list',
        label: 'Etkinlikler',
        icon: pickIcon('mdiCalendarStar'),
        permissions: 'READ_EVENTS',
      },
      {
        href: '/event_tasks/event_tasks-list',
        label: 'Etkinlik Görevleri',
        icon: pickIcon('mdiChecklist'),
        permissions: 'READ_EVENT_TASKS',
      },
      {
        href: '/event_guests/event_guests-list',
        label: 'Davetliler',
        icon: pickIcon('mdiAccountGroup'),
        permissions: 'READ_EVENT_GUESTS',
      },
      {
        href: '/event_schedule_items/event_schedule_items-list',
        label: 'Takvim Kalemleri',
        icon: pickIcon('mdiTimelineText'),
        permissions: 'READ_EVENT_SCHEDULE_ITEMS',
      },
      {
        href: '/budget_items/budget_items-list',
        label: 'Bütçe Kalemleri',
        icon: pickIcon('mdiCurrencyUsd'),
        permissions: 'READ_BUDGET_ITEMS',
      },
    ],
  },
  {
    label: 'Yönetim',
    icon: icon.mdiShieldAccountVariantOutline,
    menu: [
      {
        href: '/users/users-list',
        label: 'Kullanıcılar',
        icon: icon.mdiAccountGroup,
        permissions: 'READ_USERS',
      },
      {
        href: '/roles/roles-list',
        label: 'Roller',
        icon: icon.mdiShieldAccountVariantOutline,
        permissions: 'READ_ROLES',
      },
      {
        href: '/permissions/permissions-list',
        label: 'Yetkiler',
        icon: icon.mdiShieldAccountOutline,
        permissions: 'READ_PERMISSIONS',
      },
      {
        href: '/organizations/organizations-list',
        label: 'Organizasyonlar',
        icon: icon.mdiTable,
        permissions: 'READ_ORGANIZATIONS',
      },
      {
        href: '/profile',
        label: 'Profil',
        icon: icon.mdiAccountCircle,
      },
      {
        href: '/api-docs',
        target: '_blank',
        label: 'Swagger API',
        icon: icon.mdiFileCode,
        permissions: 'READ_API_DOCS',
      },
    ],
  },
]

export default menuAside
