import type { IListRoutes, ISites } from '@src/model'
import { tools } from '@src/store/Modules/tools'

function getRoutesEcomm(site: ISites) {

  const routes_ecommerce: IListRoutes[] = [
    {
      active: true,
      order: 30,
      path: '/products',
      materialIcon: 'fas fa-lemon',
      name: 'mypages.productslist',
      component: () => import('@src/views/ecommerce/productsList/productsList.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
    },
    {
      active: true,
      order: 30,
      path: '/checkout',
      materialIcon: 'fas fa-shopping-cart',
      name: 'mypages.checkout',
      component: () => import('@src/views/ecommerce/checkOut/checkOut.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
    },
    {
      active: tools.isManager(),
      order: 30,
      path: '/orderinfo',
      materialIcon: 'fas fa-file-alt',
      name: 'mypages.orderinfo',
      component: () => import('@src/views/ecommerce/orderInfo/orderInfo.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
    },
    /*{
      active: true,
      order: 35,
      path: '/admin/ecommerce/orders',
      materialIcon: 'fas fa-file-alt',
      name: 'mypages.orders',
      component: () => import('@src/rootgen/admin/orders/orders.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyDepartment: true
    },*/
  ]

  const routes_admin_ecommerce: IListRoutes[] = [
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/settings',
      materialIcon: 'fas fa-cogs',
      name: 'ecomm.settings',
      component: () => import('@src/rootgen/admin/settings/settings.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/cash',
      materialIcon: 'fas fa-cash-register',
      name: 'mypages.cash',
      component: () => import('@src/views/ecommerce/cash/cash.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/productInfos',
      materialIcon: 'fas fa-lemon',
      name: 'mypages.productInfos',
      component: () => import('@src/rootgen/admin/productInfos/productInfos.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/gestoreordini',
      materialIcon: 'fas fa-lemon',
      name: 'mypages.gestoreordini',
      component: () => import('@src/views/admin/gestoreordini/gestoreordini.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/products',
      materialIcon: 'fas fa-lemon',
      name: 'mypages.listinoprodotti',
      component: () => import('@src/rootgen/admin/products/products.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/producers',
      materialIcon: 'fas fa-tractor',
      name: 'mypages.producer',
      component: () => import('@src/rootgen/admin/producer/producer.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/storehouses',
      materialIcon: 'fas fa-store',
      name: 'mypages.storehouses',
      component: () => import('@src/rootgen/admin/storehouses/storehouses.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/providers',
      materialIcon: 'fas fa-file-alt',
      name: 'mypages.providers',
      component: () => import('@src/rootgen/admin/providers/providers.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/gasordini',
      materialIcon: 'fas fa-file-alt',
      name: 'mypages.gasordini',
      component: () => import('@src/rootgen/admin/gasordini/gasordini.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 30,
      path: '/admin/ecommerce/scontistica',
      materialIcon: 'fas fa-gift',
      name: 'mypages.scontisticas',
      component: () => import('@src/rootgen/admin/scontistica/scontistica.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 31,
      path: '/admin/ecommerce/departments',
      materialIcon: 'fas fa-file-alt',
      name: 'mypages.departments',
      component: () => import('@src/rootgen/admin/departments/departments.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    /*{
      active: true,
      order: 31,
      path: '/admin/ecommerce/orders',
      materialIcon: 'fas fa-file-alt',
      name: 'mypages.orders',
      component: () => import('@src/rootgen/admin/orders/orders.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },*/
    {
      active: true,
      order: 32,
      path: '/admin/ecommerce/catprods',
      materialIcon: 'fas fa-file-alt',
      name: 'mypages.catprods',
      component: () => import('@src/rootgen/admin/catprods/catprods.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },
    {
      active: true,
      order: 35,
      path: '/admin/ecommerce/collane',
      materialIcon: 'fas fa-file-alt',
      name: 'mypages.collane',
      component: () => import('@src/rootgen/admin/collane/collane.vue'),
      inmenu: true,
      submenu: true,
      level_parent: 0,
      level_child: 0.5,
      onlyManager: true,
      onlyEditor: true
    },

  ]

  const menuEcomm = [
    {
      active: site.confpages && site.confpages.enableEcommerce,
      path: '/ecommerce',
      order: 1402,
      faIcon: 'fas fa-lemon',
      materialIcon: 'fas fa-lemon',
      name: 'mypages.ecommerce',
      routes2: routes_ecommerce,
      inmenu: true,
      onlyif_logged: true,
      // onlySocioResidente: true,
      solotitle: true,
      infooter: true
    },
    ...routes_ecommerce,
    {
      active: site.confpages && site.confpages.enableEcommerce,
      path: '/admin/ecommerce',
      order: 1420,
      materialIcon: 'next_week',
      name: 'mypages.admin_ecommerce',
      routes2: routes_admin_ecommerce,
      inmenu: true,
      solotitle: true,
      onlyAdmin: true,
      onlyManager: true,
      onlyDepartment: true
    },
    ...routes_admin_ecommerce,
    {
      active: true,
      order: 1000,
      path: '/product/:idprod/:cosa',
      materialIcon: 'event',
      name: 'otherpages.product',
      component: () => import('@src/views/ecommerce/productInfo/productInfo.vue'),
      inmenu: false,
      infooter: false
    },
    {
      active: true,
      order: 1000,
      path: '/catalogo/:idprod/:cosa',
      materialIcon: 'event',
      name: 'otherpages.catalogo',
      component: () => import('@src/views/ecommerce/catalogoInfo/catalogoInfo.vue'),
      inmenu: false,
      infooter: false
    },
    {
      active: true,
      order: 1000,
      path: '/orderscart/:idorderscart',
      materialIcon: 'event',
      name: 'otherpages.orderscart',
      component: () => import('@src/views/ecommerce/orderscart/orderscart.vue'),
      inmenu: false,
      infooter: false
    },

  ]

  return menuEcomm
}


export const routesECommerce = {
  routesEcomm: getRoutesEcomm,
}
