import { expansionMenuItem, disabledMenuItem } from './utils';
import { getScopes } from '@utils/scopes';
import { USER_SCOPES } from '@constants/entities/Scope';
import { lazyLoadView } from '@utils/lazyloadview';

const scopes = getScopes([
  USER_SCOPES.MILITARY_COMMISSAR,
  USER_SCOPES.GOMU_SPECIALIST,
  USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
  // USER_SCOPES.MILITARY_CONSCRIPTION_SPECIALIST,
  USER_SCOPES.SYSTEM_ADMINISTRATOR,
]);

export default function createRoute({ path, icon, label, order }) {
  return expansionMenuItem({
    path,
    label,
    icon,
    order,
    children: [
      expansionMenuItem({
        path: 'profile-registry',
        label: 'Реестр профилей',
        children: [
          {
            component: () => import('@/recruits/layouts/basic-list-layout.vue'),
            path: 'search',
            children: [
              {
                name: 'all-notvk',
                component: () =>
                  import('@/recruits/components/registry/not-vk'),
                path: '',
                meta: {
                  place: 'drawer',
                  label: 'Поиск',
                  scopes: getScopes([
                    USER_SCOPES.MILITARY_COMMISSAR,
                    USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
                    USER_SCOPES.GOMU_SPECIALIST,
                    USER_SCOPES.GOMU_OBSERVER,
                    USER_SCOPES.SYSTEM_ADMINISTRATOR,
                    USER_SCOPES.MILITARY_COMMISSARIAT_OBSERVER,
                  ]),
                },
              },
            ],
          },
          disabledMenuItem({
            path: 'log',
            label: 'Журнал запросов',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'export',
            label: 'Выгрузка',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
        ],
      }),
      expansionMenuItem({
        path: 'up-to-date-profiles',
        label: 'Актуальные профили',
        children: [
          disabledMenuItem({
            path: 'search',
            label: 'Поиск',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'export',
            label: 'Выгрузка архив',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'log',
            label: 'Журнал запросов',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
        ],
      }),
      expansionMenuItem({
        path: 'obsolete-profiles',
        label: 'Устаревшие профили',
        children: [
          disabledMenuItem({
            path: 'search',
            label: 'Поиск',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'export',
            label: 'Выгрузка архив',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'log',
            label: 'Журнал запросов',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
        ],
      }),
      expansionMenuItem({
        path: 'profiles-archive',
        label: 'Архив профилей',
        children: [
          disabledMenuItem({
            path: 'search',
            label: 'Поиск',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'export',
            label: 'Выгрузка архив',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'log',
            label: 'Журнал запросов',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'list',
            label: 'Профили для архивирования',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
        ],
      }),
      expansionMenuItem({
        path: 'update-monitoring',
        label: 'Мониторинг актуализации',
        children: [
          disabledMenuItem({
            path: 'log',
            label: 'Журнал актуализации профилей',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'errors',
            label: 'Ошибки актуализации',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
        ],
      }),
      expansionMenuItem({
        path: 'update-requests',
        label: 'Запросы на актуализацию',
        children: [
          disabledMenuItem({
            path: 'requests',
            label: 'Запрос на актуализацию',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'results',
            label: 'Результаты запроса на актуализацию',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'errors',
            label: 'Ошибки запроса',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
        ],
      }),
      expansionMenuItem({
        path: 'data-conflicts',
        label: 'Конфликты данных',
        children: [
          disabledMenuItem({
            path: 'log',
            label: 'Журнал конфликтов',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          {
            component: () => import('@/recruits/layouts/basic-list-layout.vue'),
            path: '',
            children: [
              {
                name: 'conflict-persdata',
                components: {
                  listButtons: () =>
                    import(
                      '@/recruits/components/conflict-persdata/listButtons.vue'
                    ),
                  default: () =>
                    lazyLoadView(
                      import('@/recruits/components/conflict-persdata')
                    ),
                },
                path: 'conflict-persdata',
                meta: {
                  icon,
                  label: 'Конфликт персданные',
                  place: 'drawer',
                  order,
                  scopes: getScopes([
                    USER_SCOPES.MILITARY_COMMISSAR,
                    USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
                    USER_SCOPES.GOMU_SPECIALIST,
                    USER_SCOPES.GOMU_OBSERVER,
                    USER_SCOPES.SYSTEM_ADMINISTRATOR,
                    USER_SCOPES.MILITARY_COMMISSARIAT_OBSERVER,
                  ]),
                },
              },
            ],
          },
          disabledMenuItem({
            path: 'additional-data',
            label: 'Конфликт допданные',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'registration-data',
            label: 'Конфликт данные ВУ',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'monitoring',
            label: 'Мониторинг разрешения',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'actions',
            label: 'Журнал действий',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
        ],
      }),
      expansionMenuItem({
        path: 'profile-edits',
        label: 'Редактирование профилей',
        children: [
          disabledMenuItem({
            path: 'requests',
            label: 'Запрос на редактирование',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'log',
            label: 'Журнал изменений',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'list',
            label: 'Профили на редактирование',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
        ],
      }),
      expansionMenuItem({
        path: 'profile-deletes',
        label: 'Удаление профилей',
        children: [
          disabledMenuItem({
            path: 'log',
            label: 'Журнал удалённых',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'actions-log',
            label: 'Журнал действий',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
          disabledMenuItem({
            path: 'form',
            label: 'Удаление профиля',
            scopes: getScopes([
              USER_SCOPES.MILITARY_COMMISSAR,
              USER_SCOPES.MILITARY_RECRUIT_SPECIALIST,
              USER_SCOPES.GOMU_SPECIALIST,
              USER_SCOPES.GOMU_OBSERVER,
              USER_SCOPES.SYSTEM_ADMINISTRATOR,
            ]),
          }),
        ],
      }),
    ],
  });
}
