import { AllRequestsComponent } from './trainning-service/all-requests/all-requests.component';
import { AddRequestComponent } from './trainning-service/add-request/add-request.component';
import { CanDeactivateGuard } from './shared/can-deactivate-guards.service';
import { NgModule } from '@angular/core';
import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
import { LoginComponent } from './login/login.component';
import { RegesterComponent } from './regester/regester.component';
import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
import { AuthGuardService as AuthGuard } from './shared/auth-guard.service';
import { ServicesComponent } from './servicesItems/services.component';
import { TrainningServicesComponent } from './trainning-service/trainning-services/trainning-services.component';


const routes: Routes = [
  {path: '', redirectTo: '/ExternalPage', pathMatch: 'full'},
  {path: 'login', component: LoginComponent},
  {path: 'signup', component: RegesterComponent},
  {path: 'services/:id', component: ServicesComponent, canActivate: [AuthGuard]},
  {path: 'addRequest/:visitorId', component: AddRequestComponent, canActivate: [AuthGuard]},
  {path: 'editRequest/:visitorId/:requestId', component: AddRequestComponent, canActivate: [AuthGuard]},
  {path: 'allRequests/:visitorID', component: AllRequestsComponent, canActivate: [AuthGuard]}, 
  {path: 'trainingServices/:visitorId/:trainningServicesId', component: TrainningServicesComponent, canActivate:[AuthGuard]},
  {path: 'service/:userID/:serviceID', loadChildren: './dashboard/dashboard.module#DashBoardModule', canLoad: [AuthGuard]},
  {path: 'InternalPage' , loadChildren: './Internal-Page/internal-page.module#InternalPageModule', canLoad: [AuthGuard]},
  {path: 'ExternalPage', loadChildren: './External-Page/external-page.module#ExternalPageModule', canLoad: [AuthGuard]},
  {path: 'profile/:idProfile', component: RegesterComponent, canActivate: [AuthGuard]},
  {path: 'page-not-found', component: PageNotFoundComponent},
  {path: '**', redirectTo: '/page-not-found', pathMatch: 'full'}
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})

export class AppRoutingModule { }
