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

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

const routes = [
  {
    children: [
      {
        component: () => import('@components/organizations/index.vue'),
        meta: {
          // icon: 'work_outline',
          label: 'Организации',
          place: 'drawer',
          scopes: categories.organizations.scopes,
        },
        name: 'organizations',
        path: '',
      },
      {
        component: () => import('@components/organizations/create/index.vue'),
        meta: {
          caption: categories.organizations.label,
          // Флаг, который позволяет сделать редирект на степпер, если придёт соответствующий пуш
          hasRedirectToStepper: true,
          icon: 'create',
          label: 'organizations.createOrganization',
          scopes: getScopes([USER_SCOPES.SECURITY_ADMINISTRATOR]),
        },
        name: 'organizations-create',
        path: 'create',
      },
    ],
    component: () => lazyLoadView(import('@router/organizations/index.vue')),
    path: categories.organizations.path,
  },
];

export default routes;
