/// <reference path="app.breadcrumb.component.ts" />
import { NgModule } from '@angular/core';
import { AuthGuard } from '../providers/authguard';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
  //For All type of users
  { path: '', loadComponent: () => import('./login/login.component').then(m => m.LoginComponent) },
  { path: 'login', loadComponent: () => import('./login/login.component').then(m => m.LoginComponent) },
  { path: 'forgotPassword', loadComponent: () => import('./forgotpassword/forgotpassword.component').then(m => m.ForgotPasswordComponent) },
  { path: 'logout', loadComponent: () => import('./logout/logout.component').then(m => m.LogoutComponent), canActivate: [AuthGuard] },
  { path: 'myprofile', loadComponent: () => import('./myprofile/myprofile.component').then(m => m.MyProfileComponent), canActivate: [AuthGuard] },
  { path: 'accesslog', loadComponent: () => import('./accesslog/accesslog.component').then(m => m.AccessLogComponent), canActivate: [AuthGuard] },
 
  //Common modules
  { path: 'thissystem', loadComponent: () => import('./thissystem/thissystem.component').then(m => m.ThisSystemComponent), canActivate: [AuthGuard], data: { permissionKey: 'ELIT.1.1' } },

  { path: 'users', loadComponent: () => import('./users/users.component').then(m => m.UsersComponent), canActivate: [AuthGuard], data: { permissionKey: 'ELIT.1.2.2,ELIT.1.2.3,ELIT.1.2.3' } },
  { path: 'newuser', loadComponent: () => import('./users/newuser.component').then(m => m.NewUserComponent), canActivate: [AuthGuard], data: { permissionKey: 'ELIT.1.2.2_1' } },
  { path: 'edituser', loadComponent: () => import('./users/edituser.component').then(m => m.EditUserComponent), canActivate: [AuthGuard], data: { permissionKey: 'ELIT.1.2.2_2' } },
  { path: 'resetPwd', loadComponent: () => import('./users/resetpwd.component').then(m => m.ResetPwdComponent), canActivate: [AuthGuard], data: { permissionKey: 'ELIT.1.2.3,ELIT.1.2.3_1,ELIT.1.2.3_2' } },
  { path: 'forcelogout', loadComponent: () => import('./forcelogout/forcelogout.component').then(m => m.ForceLogoutComponent), canActivate: [AuthGuard], data: { permissionKey: 'ELIT.1.2.4,ELIT.1.2.4_1,ELIT.1.2.4_2,ELIT.1.2.4_3' } },

  //Landing Page
  { path: 'home', loadComponent: () => import('./home/home.component').then(m => m.HomeComponent), canActivate: [AuthGuard]},

  //Error handler pages
  { path: 'accessdenied', loadComponent: () => import('./accessdenied/accessdenied.component').then(m => m.AccessDeniedComponent)},
  { path: '**', loadComponent: () => import('./pagenotfound/pagenotfound.component').then(m => m.PageNotFoundComponent) }
];

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