/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CloseDetailsGuard } from '@bci-web-core/core';
import { LocationFormComponent } from './location-form/location-form.component';
import { DemoLocationLayersComponent } from './location-layers/demo-location-layers.component';
import { DemoLocationListComponent } from './location-list/demo-location-list.component';

const routes: Routes = [
  { path: '', redirectTo: 'list', pathMatch: 'full' },
  {
    path: 'list',
    component: DemoLocationListComponent,
    children: [
      {
        path: ':id',
        component: LocationFormComponent,
        canDeactivate: [CloseDetailsGuard],
      },
    ],
  },
  {
    path: 'layers',
    component: DemoLocationLayersComponent,
  },
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  providers: [CloseDetailsGuard],
})
export class LocationDemosRoutingModule {}
