import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { CrudGridComponent, TemplateResolver, DirtyGuard, RecordResolver } from '@xdf/gallery';
import { AuthGuard, ResourceAuthGuard } from '@xdf/security';
import { AgenteComponent } from './agente/agente.component';
import { AereopuertoComponent } from './aereopuerto/aereopuerto.component';
import { VueloComponent } from './vuelo/vuelo.component';


const routes: Routes = [
  {
    path: 'agentes', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
    resolve: { record: TemplateResolver },
    data: {
      innerTemplate: 'none',
      option: 'agentes',
      program: 'agentes',
      breadcrumb: 'breadcrumb.agentes'
    }
  },
  {
    path: 'agentes/detail/:mode', component: AgenteComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
    resolve: { record: RecordResolver },
    data: {
      program: 'agentes',
      breadcrumb: 'breadcrumb.agentes.detail'
    }
  },
  {
    path: 'aereopuertos', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
    resolve: { record: TemplateResolver },
    data: {
      innerTemplate: 'none',
      option: 'aereopuertos',
      program: 'aereopuertos',
      breadcrumb: 'breadcrumb.aereopuertos'
    }
  },
  {
    path: 'aereopuertos/detail/:mode', component: AereopuertoComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
    resolve: { record: RecordResolver },
    data: {
      program: 'aereopuertos',
      breadcrumb: 'breadcrumb.aereopuertos.detail'
    }
  },
  {
    path: 'vuelos', component: CrudGridComponent, canActivate: [AuthGuard, ResourceAuthGuard],
    resolve: { record: TemplateResolver },
    data: {
      innerTemplate: 'none',
      option: 'vuelos',
      program: 'vuelos',
      breadcrumb: 'breadcrumb.vuelos'
    }
  },
  {
    path: 'vuelos/detail/new', component: VueloComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
    resolve: { record: RecordResolver },
    data: {
      mode: 'create',
      program: 'vuelos',
      breadcrumb: 'breadcrumb.vuelos.detail',
      backButton: true
    }
  },
  {
    path: 'vuelos/detail/edit', component: VueloComponent, canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
    resolve: { record: RecordResolver },
    data: {
      mode: 'edit',
      program: 'vuelos',
      breadcrumb: 'breadcrumb.vuelos.detail',
      backButton: true
    }
  }
];

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