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

const menuAside: MenuAsideItem[] = [
  {
    href: '/dashboard',
    icon: icon.mdiViewDashboardOutline,
    label: 'Home',
  },
  {
    label: 'Projects',
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    icon: 'mdiGreenhouse' in icon ? icon['mdiGreenhouse' as keyof typeof icon] : icon.mdiTable,
    menu: [
      {
        href: '/projects/projects-list',
        label: 'Projects List',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiGreenhouse' in icon ? icon['mdiGreenhouse' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_PROJECTS'
      },
      {
        href: '/trial_sites/trial_sites-list',
        label: 'Trial Sites',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiMapMarker' in icon ? icon['mdiMapMarker' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_TRIAL_SITES'
      },
      {
        href: '/organizations/organizations-list',
        label: 'Organizations',
        icon: icon.mdiTable,
        permissions: 'READ_ORGANIZATIONS'
      },
      {
        href: '/tenants/tenants-list',
        label: 'Tenants',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiDomain' in icon ? icon['mdiDomain' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_TENANTS'
      },
    ]
  },
  {
    label: 'Trials',
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    icon: 'mdiFlask' in icon ? icon['mdiFlask' as keyof typeof icon] : icon.mdiTable,
    menu: [
      {
        href: '/trials/trials-list',
        label: 'Trials List',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiFlask' in icon ? icon['mdiFlask' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_TRIALS'
      },
      {
        href: '/trial_entries/trial_entries-list',
        label: 'Trial Entries',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiTagMultiple' in icon ? icon['mdiTagMultiple' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_TRIAL_ENTRIES'
      },
      {
        href: '/varieties/varieties-list',
        label: 'Varieties',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiSprout' in icon ? icon['mdiSprout' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_VARIETIES'
      },
      {
        href: '/plots/plots-list',
        label: 'Plots',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiGrid' in icon ? icon['mdiGrid' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_PLOTS'
      },
      {
        href: '/plants/plants-list',
        label: 'Plants',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiFlower' in icon ? icon['mdiFlower' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_PLANTS'
      },
    ]
  },
  {
    label: 'Tracking',
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    icon: 'mdiChartBellCurve' in icon ? icon['mdiChartBellCurve' as keyof typeof icon] : icon.mdiTable,
    menu: [
      {
        href: '/observations/observations-list',
        label: 'Observations',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiChartBellCurve' in icon ? icon['mdiChartBellCurve' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_OBSERVATIONS'
      },
      {
        href: '/observation_events/observation_events-list',
        label: 'Observation Events',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiClipboardText' in icon ? icon['mdiClipboardText' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_OBSERVATION_EVENTS'
      },
      {
        href: '/traits/traits-list',
        label: 'Traits',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiRuler' in icon ? icon['mdiRuler' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_TRAITS'
      },
      {
        href: '/media_assets/media_assets-list',
        label: 'Media Assets',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiImageMultiple' in icon ? icon['mdiImageMultiple' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_MEDIA_ASSETS'
      },
    ]
  },
  {
    href: '/users/users-list',
    label: 'Users',
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    icon: icon.mdiAccountGroup ?? icon.mdiTable,
    permissions: 'READ_USERS'
  },
  {
    label: 'Reports',
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    icon: 'mdiFileChart' in icon ? icon['mdiFileChart' as keyof typeof icon] : icon.mdiTable,
    menu: [
      {
        href: '/reports/reports-list',
        label: 'Reports List',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiFileChart' in icon ? icon['mdiFileChart' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_REPORTS'
      },
      {
        href: '/report_templates/report_templates-list',
        label: 'Report Templates',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiFileDocumentOutline' in icon ? icon['mdiFileDocumentOutline' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_REPORT_TEMPLATES'
      },
    ]
  },
  {
    label: 'Settings',
    icon: icon.mdiCog,
    menu: [
      {
        href: '/roles/roles-list',
        label: 'Roles',
        icon: icon.mdiShieldAccountVariantOutline,
        permissions: 'READ_ROLES'
      },
      {
        href: '/permissions/permissions-list',
        label: 'Permissions',
        icon: icon.mdiShieldAccountOutline,
        permissions: 'READ_PERMISSIONS'
      },
      {
        href: '/api_clients/api_clients-list',
        label: 'API Clients',
        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-ignore
        icon: 'mdiApi' in icon ? icon['mdiApi' as keyof typeof icon] : icon.mdiTable,
        permissions: 'READ_API_CLIENTS'
      },
      {
        href: '/profile',
        label: 'Profile',
        icon: icon.mdiAccountCircle,
      },
      {
        href: '/api-docs',
        target: '_blank',
        label: 'Swagger API',
        icon: icon.mdiFileCode,
        permissions: 'READ_API_DOCS'
      },
    ]
  }
]

export default menuAside
