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

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

const routes = [
  {
    children: [
      {
        component: () => import('@components/solutions/index.vue'),
        meta: {
          icon: 'category',
          label: 'solutions.solutions',
          place: 'drawer',
          order: 6,
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        name: 'solutions',
        path: '',
        props: (route) => {
          return {
            searchQuery: {
              onlyMy: !(route.query.onlyMy === 'false'),
              search: route.query.search,
            },
          };
        },
      },
      {
        component: () => import('@components/solutions/create/index.vue'),
        meta: {
          caption: categories.solutions.label,
          // Флаг, который позволяет сделать редирект на степпер, если придёт соответствующий пуш
          hasRedirectToStepper: true,
          icon: 'create',
          label: 'solutions.createApplication',
          showProd: Vue.prototype.$appConfig.isDebugMode === 'true',
        },
        name: 'solutions-create',
        path: 'create',
      },
    ],
    component: () => lazyLoadView(import('@router/solutions/index.vue')),
    meta: {
      scopes: categories.solutions.scopes,
    },
    path: categories.solutions.path,
  },
];

export default routes;
