import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { CrudGridComponent, DirtyGuard, RecordResolver, TemplateResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
import { PasajeroComponent } from './pasajero/pasajero.component';
import { ReservaComponent } from './reserva/views/reserva-detail/reserva.component';


const routes: Routes = [
  {
    path: 'pasajeros', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
    resolve: { record: TemplateResolver },
    data: {
      innerTemplate: 'none',
      option: 'pasajeros',
      program: 'pasajeros',
      breadcrumb: 'breadcrumb.pasajeros'
    }
  },
  {
    path: 'pasajeros/detail/:mode', component: PasajeroComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
    resolve: { record: RecordResolver },
    data: {
      program: 'pasajeros',
      breadcrumb: 'breadcrumb.pasajeros.detail'
    }
  },
  {
    path: 'reservas', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
    resolve: { record: TemplateResolver },
    data: {
      innerTemplate: 'none',
      option: 'reservas',
      program: 'reservas',
      breadcrumb: 'breadcrumb.reservas'
    }
  },
  {
    path: 'reservas/detail/:mode', component: ReservaComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
    resolve: { record: RecordResolver },
    data: {
      program: 'reservas',
      breadcrumb: 'breadcrumb.reservas.detail'
    }
  },
];

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