import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { PageNotFoundComponent } from '@shared/error-handling/page-not-found/page-not-found.component';
import { EnduserComponent } from '../enduser/enduser.component';
import { CurrentUserResolver } from '@shared/auth/current-user.resolver';
import { urlMatcher } from '@shared/ui/common/utils';

const routes: Routes = [
  {
    matcher: urlMatcher,
    loadChildren: () => import('../enduser.module').then(mod => mod.EnduserModule),
    component: EnduserComponent,
    data: {
      configurationName: 'enduser',
    },
    resolve: {
      currentUser: CurrentUserResolver
    },
  },
  {
    path: '**',
    component: PageNotFoundComponent,
    resolve: {
      currentUser: CurrentUserResolver
    },
  }
];


@NgModule({
  imports: [RouterModule.forRoot(routes, {onSameUrlNavigation: 'reload'})],
  exports: [RouterModule]
})
export class AppEndUserRoutingModule {
}
