import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
import { AuthGuard } from './_core/_guard/auth.guard';
import { AppGuard } from './_core/_guard/app.guard';
import { SuperAdminAuthGuard } from './_core/_guard/superadmin.guard';
import { AnalystAuthGuard } from './_core/_guard/analysts.guard';
import { AdminAuthGuard } from './_core/_guard/admin.guard';
import { UserAuthGuard } from './_core/_guard/user.guard';

const routes: Routes = [
  { path: 'auth', canActivate: [AppGuard], loadChildren: () => import('./_modules/auth/auth.module').then(m => m.AuthModule) },
  { path: 'analyst', canActivate: [AnalystAuthGuard], canActivateChild: [AnalystAuthGuard], loadChildren: () => import('./_modules/analyst/dashboard.module').then(m => m.DashboardModule) },
  { path: 'admin', canActivate: [AdminAuthGuard], canActivateChild: [AdminAuthGuard], loadChildren: () => import('./_modules/admin/dashboard.module').then(m => m.DashboardModule) },
  { path: 'sadmin', canActivate: [SuperAdminAuthGuard], canActivateChild: [SuperAdminAuthGuard], loadChildren: () => import('./_modules/super-admin/dashboard.module').then(m => m.DashboardModule) },
  { path: '', canActivate: [AuthGuard], canActivateChild: [AuthGuard], loadChildren: () => import('./_modules/user/dashboard.module').then(m => m.DashboardModule) },
  { path: 'policy',loadChildren: () => import('./_modules/policy/policy.module').then(m => m.PolicyModule)  }
];

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

export class AppRoutingModule {
}
