import { RouterView } from 'vue-router';

export default {
    path: '/item',
    name: 'Item',
    meta: {
        title: 'items',
        icon: 'vn:item',
        moduleName: 'Item',
        keyBinding: 'a',
    },
    component: RouterView,
    redirect: { name: 'ItemMain' },
    menus: {
        main: [
            'ItemList',
            'WasteBreakdown',
            'ItemFixedPrice',
            'ItemRequest',
            'ItemTypeList',
        ],
        card: [
            'ItemBasicData',
            'ItemLog',
            'ItemDiary',
            'ItemTags',
            'ItemTax',
            'ItemBotanical',
            'ItemBarcode',
            'ItemShelving',
            'ItemLastEntries',
            'ItemTags',
        ],
    },
    children: [
        {
            path: '',
            name: 'ItemMain',
            component: () => import('src/components/common/VnSectionMain.vue'),
            redirect: { name: 'ItemList' },
            children: [
                {
                    path: 'list',
                    name: 'ItemList',
                    meta: {
                        title: 'list',
                        icon: 'view_list',
                    },
                    component: () => import('src/pages/Item/ItemList.vue'),
                },
                {
                    path: 'fixed-price',
                    name: 'ItemFixedPrice',
                    meta: {
                        title: 'fixedPrice',
                        icon: 'vn:fixedPrice',
                    },
                    component: () => import('src/pages/Item/ItemFixedPrice.vue'),
                },
                {
                    path: 'create',
                    name: 'ItemCreate',
                    meta: {
                        title: 'itemCreate',
                    },
                    component: () => import('src/pages/Item/ItemCreate.vue'),
                },
                {
                    path: 'waste-breakdown',
                    name: 'WasteBreakdown',
                    meta: {
                        title: 'wasteBreakdown',
                        icon: 'vn:claims',
                    },
                    beforeEnter: (to, from, next) => {
                        next({ name: 'ItemList' });
                        window.location.href =
                            'https://grafana.verdnatura.es/d/TTNXQAxVk';
                    },
                },
                {
                    path: 'item-type-list',
                    name: 'ItemTypeList',
                    meta: {
                        title: 'family',
                        icon: 'contact_support',
                    },
                    component: () => import('src/pages/Item/ItemTypeList.vue'),
                },
                {
                    path: 'item-type-list/create',
                    name: 'ItemTypeCreate',
                    meta: {
                        title: 'itemTypeCreate',
                    },
                    component: () => import('src/pages/Item/ItemTypeCreate.vue'),
                },
                {
                    path: 'request',
                    name: 'ItemRequest',
                    meta: {
                        title: 'buyRequest',
                        icon: 'vn:buyrequest',
                    },
                    component: () => import('src/pages/Item/ItemRequest.vue'),
                },
            ],
        },
        {
            name: 'ItemCard',
            path: ':id',
            component: () => import('src/pages/Item/Card/ItemCard.vue'),
            redirect: { name: 'ItemSummary' },
            children: [
                {
                    name: 'ItemSummary',
                    path: 'summary',
                    meta: {
                        title: 'summary',
                        icon: 'launch',
                    },
                    component: () => import('src/pages/Item/Card/ItemSummary.vue'),
                },
                {
                    path: 'basic-data',
                    name: 'ItemBasicData',
                    meta: {
                        title: 'basicData',
                        icon: 'vn:settings',
                    },
                    component: () => import('src/pages/Item/Card/ItemBasicData.vue'),
                },
                {
                    path: 'tags',
                    name: 'ItemTags',
                    meta: {
                        title: 'tags',
                        icon: 'vn:tags',
                    },
                    component: () => import('src/pages/Item/Card/ItemTags.vue'),
                },
                {
                    path: 'last-entries',
                    name: 'ItemLastEntries',
                    meta: {
                        title: 'lastEntries',
                        icon: 'vn:regentry',
                    },
                    component: () => import('src/pages/Item/Card/ItemLastEntries.vue'),
                },
                {
                    path: 'tax',
                    name: 'ItemTax',
                    meta: {
                        title: 'tax',
                        icon: 'vn:tax',
                    },
                    component: () => import('src/pages/Item/Card/ItemTax.vue'),
                },
                {
                    path: 'botanical',
                    name: 'ItemBotanical',
                    meta: {
                        title: 'botanical',
                        icon: 'local_florist',
                    },
                    component: () => import('src/pages/Item/Card/ItemBotanical.vue'),
                },
                {
                    path: 'shelving',
                    name: 'ItemShelving',
                    meta: {
                        title: 'shelving',
                        icon: 'vn:inventory',
                    },
                    component: () => import('src/pages/Item/Card/ItemShelving.vue'),
                },
                {
                    path: 'barcode',
                    name: 'ItemBarcode',
                    meta: {
                        title: 'barcode',
                        icon: 'vn:barcode',
                    },
                    component: () => import('src/pages/Item/Card/ItemBarcode.vue'),
                },
                {
                    path: 'diary',
                    name: 'ItemDiary',
                    meta: {
                        title: 'diary',
                        icon: 'vn:transaction',
                    },
                    component: () => import('src/pages/Item/Card/ItemDiary.vue'),
                },
                {
                    path: 'log',
                    name: 'ItemLog',
                    meta: {
                        title: 'log',
                        icon: 'vn:History',
                    },
                    component: () => import('src/pages/Item/Card/ItemLog.vue'),
                },
            ],
        },
    ],
};
