import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
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,
        canDeactivate: [PreviousRouteRecorder]
      },
      {
        path: ':stakeholder/develop',
        loadChildren: '../develop/develop.module#DevelopModule',
        resolve: {envSpecific: EnvironmentSpecificResolver},
        data: {
          hasSidebar: false,
          isDashboard: false
        }
      },
      {
        path: ':stakeholder/search',
        loadChildren: '../search/search.module#SearchModule',
        resolve: {envSpecific: EnvironmentSpecificResolver}
      },
      {
        path: ':stakeholder/:topic',
        component: MonitorComponent,
        canDeactivate: [PreviousRouteRecorder]
      },
      {
        path: ':stakeholder/:topic/:category',
        component: MonitorComponent,
        canDeactivate: [PreviousRouteRecorder]
      },
      {
        path: ':stakeholder/:topic/:category/:subCategory',
        component: MonitorComponent,
        canDeactivate: [PreviousRouteRecorder]
      }
    ])
  ]
})
export class MonitorRoutingModule {
}
