import scopes from '@utils/scopes';
import { USER_SCOPES } from '@constants/entities/Scope';
import { lazyLoadView } from '@utils/lazyloadview';
import Vue from 'vue';

const categories = {
  registries: {
    label: 'registries.label',
    path: 'registries',
    scopes: scopes.registries,
  },
};

const routes = [
  {
    children: [
      {
        component: () => import('@components/registries/order-page.vue'),
        meta: {
          icon: 'receipt',
          label: 'registries.registryOrder.label',
          place: 'drawer',
          drawerWhiteList: [
            USER_SCOPES.ORDER_OPERATOR,
            USER_SCOPES.ORDER_ADMIN,
          ],
          order: 20,
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        name: 'registry-orders',
        path: '/registries/order',
      },
      {
        component: () => import('@components/registries/order-list.vue'),
        drawerWhiteList: [
          USER_SCOPES.ORDER_OPERATOR,
          USER_SCOPES.ORDER_ADMIN,
        ],
        meta: {
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        name: 'registry-order',
        path: '/registries/order/:id',
      },

      {
        component: () => import('@components/registries/payment-page.vue'),
        meta: {
          icon: 'account_balance_wallet',
          label: 'registries.registryPayment.label',
          place: 'drawer',
          drawerWhiteList: [
            USER_SCOPES.PAYMENTS_OPERATOR,
            USER_SCOPES.PAYMENTS_ADMIN,
          ],
          order: 20,
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        name: 'registry-payments',
        path: '/registries/payments',
      },
      {
        component: () => import('@components/registries/payment-list.vue'),
        drawerWhiteList: [
          USER_SCOPES.PAYMENTS_OPERATOR,
          USER_SCOPES.PAYMENTS_ADMIN,
        ],
        meta: {
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        name: 'registry-payment',
        path: '/registries/payment/:id',
      },

      {
        component: () => import('@components/registries/index.vue'),
        meta: {
          icon: 'storage',
          label: categories.registries.label,
          place: 'drawer',
          order: 20,
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        name: 'registries',
        path: '',
      },
      {
        component: () => import('@components/registries/list.vue'),
        meta: {
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        name: 'registry-list',
        path: '/registries/:id',
      },
    ],
    component: () => lazyLoadView(import('@router/registries/index.vue')),
    meta: {
      scopes: categories.registries.scopes,
    },
    path: categories.registries.path,
  },
];

export default routes;
