import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { LayoutPageComponent } from './auth/pages/layout-page/layout-page.component';
import { Page404Component } from './shared/page404/page404.component';
import { authGuard, loginGuard } from './auth/guards/auth.guard';

const routes: Routes = [
  { path: 'auth', loadChildren: () => import('./auth/auth.module').then(m => m.AuthModule), canActivate: [loginGuard] },
  // { path: 'auth', component: LayoutPageComponent },

  { path: 'homeAdmin', loadChildren: () => import('./modules/Administrador/administrador.module').then(m => m.AdministradorModule), canActivate: [authGuard], data: { role: 'AD' } },
  { path: 'homePadres', loadChildren: () => import('./modules/Padres/padres.module').then(m => m.PadresModule), canActivate: [authGuard], data: { role: ['AD', 'PF'] } },

  // { path: 'homeAdmin', loadChildren: () => import('./modules/Administrador/administrador.module').then(m => m.AdministradorModule) },
  // { path: 'homePadres', loadChildren: () => import('./modules/Padres/padres.module').then(m => m.PadresModule) },

  { path: '404', component: Page404Component },
  { path: '', redirectTo: 'auth', pathMatch: 'full' },
  { path: '**', redirectTo: '404' }
];

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