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

const routes: Routes = [
  { path: 'auth', canActivate: [AppGuard], loadChildren: () => import('./_modules/auth/auth.module').then(m => m.AuthModule) },
  { path: '', canActivate: [AuthGuard], canActivateChild: [AuthGuard], loadChildren: () => import('./_modules/dashboard/dashboard.module').then(m => m.DashboardModule) },
];

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

export class AppRoutingModule {
}
