import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { AuthGuard } from './services/values.auth';

const routes: Routes = [
  {
    path: 'home',
    loadChildren: () => import('./home/home.module').then( m => m.HomePageModule)
  },
  {
    path: 'beliefs',
    loadChildren: () => import('./beliefs/beliefs.module').then( m => m.BeliefsPageModule)
  },
  {
    path: 'valuesSorting',
    loadChildren: () => import('./valuesSorting/valuesSorting.module').then( m => m.ValuesSortingPageModule), canActivate: [AuthGuard]
  },
  {
    path: 'valuesAlign',
    loadChildren: () => import('./valuesAlign/valuesAlign.module').then( m => m.ValuesAlignPageModule), canActivate: [AuthGuard]
  },
  {
    path: 'valuesRanking',
    loadChildren: () => import('./valuesRanking/valuesRanking.module').then( m => m.ValuesRankingPageModule), canActivate: [AuthGuard]
  },
  {
    path: 'valuesAdd',
    loadChildren: () => import('./valuesAdd/valuesAdd.module').then( m => m.ValuesAddPageModule), canActivate: [AuthGuard]
  },
  {
    path: '',
    redirectTo: 'home',
    pathMatch: 'full'
  },
];

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