import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Routes, RouterModule } from '@angular/router';
import { CrudGridComponent, TemplateResolver, DirtyGuard, RecordResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
import { ReservationFormComponent } from './components/reservation-form/reservation-form.component';
import { PasajeroDialogService } from './components/reservation-pasajero-dialog/services/reservation-pasajero-dialog.service';
import { VueloDialogService } from './components/reservation-vuelo-dialog/services/reservation-vuelo-dialog.service';

const routes: Routes = [
  {
    path: "reservation", component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
    resolve: { Template: TemplateResolver },
    data: {
      innerTemplate: 'none',
      program: "reservation",
      breadcrumb: "breadcrumb.flight"
    },
  }
,
  {
    path: 'reservation/detail/:mode', component: ReservationFormComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
    resolve: { record: RecordResolver},
    data: {
      program: 'reservation',
      breadcrumb: 'breadcrumb.flight.detail'
    }
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  providers: [PasajeroDialogService,
    VueloDialogService]
})
export class ReservationRoutigModule { }
