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';


const routes: Routes = [
  {path: '', redirectTo: '/ExternalPage', pathMatch: 'full'},
  {path: 'login', component: LoginComponent},
  {path: 'signup', component: RegesterComponent},
  {path: 'services/:id', component: ServicesComponent, canActivate: [AuthGuard]},
  {path: 'service/:userID/:serviceID', loadChildren: './dashboard/dashboard.module#DashBoardModule', canLoad: [AuthGuard]},
  {path: 'InternalPage' , loadChildren: './Internal-Page/internal-page.module#InternalPageModule'},
  {path: 'ExternalPage', loadChildren: './External-Page/external-page.module#ExternalPageModule'},
  {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 { }
