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

export default function createRoute({ path, icon, label, order }) {
  return expansionMenuItem({
    path,
    label,
    icon,
    order,
    children: [
      {
        path: '',
        component: () =>
          lazyLoadView(import('@/recruits/layouts/basic-list-layout')),
        children: [
          {
            name: 'registration-signing',
            components: {
              listButtons: () =>
                import(
                  '@/recruits/components/registration-signing/listButtons.vue'
                ),
              default: () =>
                import('@/recruits/components/registration-signing'),
            },
            path: 'signing',
            meta: {
              label: 'Решения',
              place: 'drawer',
              scopes: getScopes([USER_SCOPES.MILITARY_COMMISSAR]),
              storeCountGetters: 'menuCounters/batchSigning',
            },
          },
          {
            name: 'subpoena-signing',
            components: {
              listButtons: () =>
                import(
                  '@/recruits/components/subpoena-signing/listButtons.vue'
                ),
              default: () => import('@/recruits/components/subpoena-signing'),
            },
            path: 'subpoena-signing',
            meta: {
              label: 'Повестки',
              place: 'drawer',
              scopes: getScopes([USER_SCOPES.MILITARY_COMMISSAR]),
            },
          },
        ],
      },
    ],
  });
}
