import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {MonitorComponent} from "./monitor.component";
import {EnvironmentSpecificResolver} from "../openaireLibrary/utils/properties/environmentSpecificResolver";

@NgModule({
  imports: [
    RouterModule.forChild([
      {path: '', redirectTo: '/admin', pathMatch: 'full'},
      {
        path: ':stakeholder',
        component: MonitorComponent,
        canActivate: [FreeGuard],
        canDeactivate: [PreviousRouteRecorder]
      },
      {
        path: ':stakeholder/search',
        loadChildren: '../search/search.module#SearchModule',
        resolve: {envSpecific: EnvironmentSpecificResolver}
      },
      {
        path: ':stakeholder/:topic',
        component: MonitorComponent,
        canActivate: [FreeGuard],
        canDeactivate: [PreviousRouteRecorder]
      },
      {
        path: ':stakeholder/:topic/:category',
        component: MonitorComponent,
        canActivate: [FreeGuard],
        canDeactivate: [PreviousRouteRecorder]
      },
      {
        path: ':stakeholder/:topic/:category/:subCategory',
        component: MonitorComponent,
        canActivate: [FreeGuard],
        canDeactivate: [PreviousRouteRecorder]
      }
    ])
  ]
})
export class MonitorRoutingModule {
}
