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

import {CrisisCenterHomeComponent} from './crisis-center-home/crisis-center-home.component';
import {CrisisListComponent} from './crisis-list/crisis-list.component';
import {CrisisCenterComponent} from './crisis-center/crisis-center.component';
import {CrisisDetailComponent} from './crisis-detail/crisis-detail.component';

import {canDeactivateGuard} from '../can-deactivate.guard';
import {crisisDetailResolver} from './crisis-detail-resolver';

const crisisCenterRoutes: Routes = [
  {
    path: '',
    component: CrisisCenterComponent,
    children: [
      {
        path: '',
        component: CrisisListComponent,
        children: [
          {
            path: ':id',
            component: CrisisDetailComponent,
            canDeactivate: [canDeactivateGuard],
            resolve: {
              crisis: crisisDetailResolver,
            },
          },
          {
            path: '',
            component: CrisisCenterHomeComponent,
          },
        ],
      },
    ],
  },
];

@NgModule({
  imports: [RouterModule.forChild(crisisCenterRoutes)],
  exports: [RouterModule],
})
export class CrisisCenterRoutingModule {}
// #enddocregion
