// @ts-nocheck
import {Routes} from '@angular/router';
{%- macro categoryImport(entry) -%}
{%- if entry.item.isCategory %}
import {{ entry.item.id }} from '{{ curDir | createImportPath(entry.item.path) }}';
{%- endif -%}
{%- for child in entry.children -%}
{{ categoryImport(child) }}
{%- endfor -%}
{%- endmacro -%}

{%- for entry in entries -%}
{{ categoryImport(entry) }}
{%- endfor %}

export const NG_DOC_ROUTING: Routes = [
	{%- macro route(entry) %}
	{
		path: '{{ entry.item.route }}',
		title: `{{ entry.item.title | toTemplateString }}`,
    {%- if entry.item.isCategory %}
    providers: [
      ...({{ entry.item.id }}.providers ?? []),
    ],
    {%- endif %}
		{%- if entry.children.length %}
		children: [{
			path: '',
			redirectTo: '{{ entry.children[0].item.route }}',
			pathMatch: 'full'
		},
			{%- for child in entry.children -%}
			{{ route(child) }}
			{%- endfor -%}
		],
		{%- else %}
		loadChildren: () => import('./{{ curDir | createImportPath(entry.item.outDir + "/page.ts") }}'),
		{%- endif %}
	},
	{%- endmacro %}
	{%- for entry in entries %}
	{{ route(entry) }}
	{%- endfor %}
];
