import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CrudGridComponent, DirtyGuard, RecordResolver, TemplateResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
import { ReservationFormComponent } from './components/reservation-form/reservation-form.component';
import { ReservationPassengerDialogService } from './components/reservation-passenger-dialog/services/reservation-passenger-dialog.service';
import { ReservationFlightDialogService } from './components/reservation-flight-dialog/services/reservation-flight-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: [
    ReservationPassengerDialogService,
    ReservationFlightDialogService
  ]
})
export class ReservationRoutingModule { }
