import { RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';

import { PagesComponent } from './pages.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { UsersComponent } from './users/users.component';
import { CustomerComponent } from './customer/customer.component';
import { DriverComponent } from './driver/driver.component';
import { ProductComponent } from './product/product.component';
import { AuthGuard } from './_guard/auth.guard';
import { OrderComponent } from './order/order.component';
import { OrderFormComponent } from './order/order-form/order-form.component';
import { ProfileComponent } from './profile/profile.component';
import { SummaryListComponent } from './summary-list/summary-list.component';
import { SummaryDetailsComponent } from './summary-list/summary-details/summary-details.component';
import { EmailComponent } from './email/email.component';
import { DriverySheetComponent } from './drivery-sheet/drivery-sheet.component';
import { ReturnSheetComponent } from './return-sheet/return-sheet.component';
import { OrderDGuard } from './_guard/order-d.guard';

const routes: Routes = [{
  path: '',
  canActivateChild:[AuthGuard],
  component: PagesComponent,
  children: [
    {
      path: 'dashboard',
      component: DashboardComponent,
    },
    {
      path: 'users',
      component: UsersComponent,
    },

    {
      path: 'customer',
      component: CustomerComponent,
    },
    
    {
      path: 'driver',
      component: DriverComponent,
    },
    {
      path: 'product',
      component: ProductComponent,
    },
    {
      path: 'order',
      component: OrderComponent,
    },
    {
      path: 'email',
      component: EmailComponent,
    },
    {
      path: 'profile',
      component: ProfileComponent,
    },
    {
      path: 'order/add',
      component: OrderFormComponent,
      canActivate: [OrderDGuard]
    },{
      path: 'summary',
      component:SummaryListComponent
    },{
      path: 'summary/:orderId',
      component:SummaryDetailsComponent
      
    },{

      path: 'delivery-sheet',
      component:DriverySheetComponent
      
    },{

      path: 'return-sheet',
      component:ReturnSheetComponent
      
    }

    
 
  ],
}];

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