import scopes from '@utils/scopes';
import { lazyLoadView } from '@utils/lazyloadview';
import Vue from 'vue';

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

const routes = [
  {
    children: [
      {
        component: () => import('@components/reports/list.vue'),
        meta: {
          icon: 'equalizer',
          label: categories.reports.label,
          place: 'drawer',
          order: 12,
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        name: 'reports',
        path: '',
      },
      {
        component: () => import('@components/reports/index.vue'),
        name: 'reports-list',
        path: ':parentId',
        meta: {
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        props: (route) => {
          return {
            parentId: route.params.parentId,
            searchQuery: {
              auto: !(route.query.onlyMy === 'false'),
            },
          };
        },
      },
    ],
    component: () => lazyLoadView(import('@router/reports/index.vue')),
    meta: {
      scopes: categories.reports.scopes,
    },
    path: categories.reports.path,
  },
];

export default routes;
