import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { ReactiveFormsModule } from '@angular/forms';

// Shared components
import { SharedModule } from '../../shared/shared.module';

// Module components
import { EtatsdeventesListComponent } from './components/etatsdeventes-list/etatsdeventes-list.component';
import { PnrListComponent } from './components/pnr-list/pnr-list.component';
import { BilletsTestComponent } from './billets-test.component';
import { BilletsDiagnosticComponent } from './billets-diagnostic.component';

// Services
import { BilletsService } from './services/billets.service';

// Routes du module Billets
const routes: Routes = [
  { path: 'test', component: BilletsTestComponent },
  { path: 'diagnostic', component: BilletsDiagnosticComponent },
  {
    path: 'etatsdeventes',
    children: [
      { path: 'list', component: EtatsdeventesListComponent },
      { path: '', redirectTo: 'list', pathMatch: 'full' }
    ]
  },
  {
    path: 'pnr',
    children: [
      { path: 'list', component: PnrListComponent },
      { path: '', redirectTo: 'list', pathMatch: 'full' }
    ]
  },
  { path: '', redirectTo: 'test', pathMatch: 'full' }
];

@NgModule({
  declarations: [
    EtatsdeventesListComponent,
    PnrListComponent,
    BilletsTestComponent,
    BilletsDiagnosticComponent
  ],
  imports: [
    CommonModule,
    ReactiveFormsModule,
    RouterModule.forChild(routes),
    SharedModule
  ],
  providers: [
    BilletsService
  ]
})
export class BilletsModule { }
