import {NgModule} from "@angular/core";
import {RouterModule, Routes} from "@angular/router";
import {
  ConfirmExitGuard
} from "@webbpm/base-package";
import {APP_BASE_HREF} from "@angular/common";
import {MfeConfigurationProvider} from "./provider/mfe-configuration.provider";
import {RolesGuard} from "../app/guard/RolesGuard";
import {AccessDeniedComponent} from "../app/component/access-denied.component";

const webbpmRoutes: Routes = [
  {
    path: 'access-denied',
    component: AccessDeniedComponent,
  },
  {
    path: '',
    loadChildren: 'generated-sources/page-conversion.module#PageconversionModule',
    canActivate: [ConfirmExitGuard, RolesGuard],
    pathMatch: 'full',
  },
  {
    path: '**',
    redirectTo: '',
  }
];

@NgModule({
            providers: [
              {provide: APP_BASE_HREF, useFactory: () => MfeConfigurationProvider.getPageBaseUrl()}
            ],
            imports: [RouterModule.forRoot(webbpmRoutes, {
              useHash: false,
              onSameUrlNavigation: "reload"
            })],
            exports: [RouterModule]
          })
export class MfeWebbpmRoutingModule {

}
