import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { CrudGridComponent, DirtyGuard, RecordResolver, TemplateResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
import { FlightFormComponent } from './components/flight-form/flight-form.component';
import { FlightLegDialogService } from './components/flight-leg-dialog/services/flight-leg-dialog.service';



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

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