import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { routes } from '@root.npm.pkg@';
// DON'T PAY ATTENTION TO IMPORT ERRORS HERE, those files are injected at serve/build time
import { appConfig } from '../config/index';
import { FallbackComponent } from './fallback.component';
import { ModuleComponent } from './module.component';

const elementRoutes: Routes = [
    { path: '', component: ModuleComponent },
    {
        path: `${appConfig.global.baseUrl}@sub.route.url@`,
        children: routes,
    },
    { path: '**', component: FallbackComponent },
];

// @dynamic
@NgModule({
    imports: [
        RouterModule.forRoot(elementRoutes),
    ],
    exports: [
        RouterModule,
    ],
})
export class RoutingModule {
}
