import { ExtraOptions, Routes } from '@angular/router';
import { IsLoggedGuard, RedirectGuard } from './core';

export const routerOptions: ExtraOptions = {
  anchorScrolling: 'enabled',
  scrollPositionRestoration: 'enabled',
  paramsInheritanceStrategy: 'always',
};

export const routes: Routes = [
  {
    path: '',
    loadChildren: () =>
      import('./modules/main/main.routes').then((mod) => mod.mainRoutes),
    canActivate: [IsLoggedGuard],
  },
  {
    path: 'public',
    loadChildren: () =>
      import('./modules/public/public.routes').then((mod) => mod.publicRoutes),
  },
  {
    path: 'login',
    loadComponent: () =>
      import('./modules/login/login.component').then(
        (mod) => mod.LoginComponent,
      ),
    canActivate: [RedirectGuard], // per forzare il redirect a strutture pubbliche
  },
  // {
  //   path: 'recupera-password',
  //   loadComponent: () =>
  //     import('./modules/recovery-password/recovery-password.component').then(
  //       (mod) => mod.RecoveryPasswordComponent,
  //     ),
  // },
  // {
  //   path: 'primoaccesso',
  //   loadComponent: () =>
  //     import('./modules/recovery-password/recovery-password.component').then(
  //       (mod) => mod.RecoveryPasswordComponent,
  //     ),
  // },
  {
    path: 'pagina-non-trovata',
    loadComponent: () =>
      import('./modules/page-not-found/page-not-found.component').then(
        (mod) => mod.PageNotFoundComponent,
      ),
  },
  {
    path: '**',
    loadComponent: () =>
      import('./modules/page-not-found/page-not-found.component').then(
        (mod) => mod.PageNotFoundComponent,
      ),
  },
];
