import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {OpenaireErrorPageComponent} from './error/errorPage.component';

const routes: Routes = [
  {path: '', loadChildren: () => import('./home/home.module').then(m => m.HomeModule)},
  {
    path: 'browse',
    loadChildren: () => import('./search-stakeholders/search-stakeholders.module').then(m => m.SearchStakeholdersModule)
  },
  {path: 'about', redirectTo: 'about/learn-how', pathMatch: 'full'},
  {
    path: 'about/learn-how',
    loadChildren: () => import('./learn-how/learn-how.module').then(m => m.LearnHowModule)
  },
  {
    path: 'contact-us',
    loadChildren: () => import('./contact/contact.module').then(m => m.ContactModule)
  },
  {
    path: 'reload',
    loadChildren: () => import('./reload/libReload.module').then(m => m.LibReloadModule)
  },
  {
    path: 'user-info',
    loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule)
  },
  {path: 'error', component: OpenaireErrorPageComponent},
  {path: 'theme', loadChildren: () => import('./openaireLibrary/utils/theme/theme.module').then(m => m.ThemeModule)},
  {
    path: '**',
    pathMatch: 'full',
    component: OpenaireErrorPageComponent
  }
];

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