import {NgModule, OnInit} from '@angular/core';
import {ActivatedRoute, Router, RouterModule, Routes} from '@angular/router';
import {HomeComponent} from './component/home/home.component';
import {ResourceComponent} from "./component/resource/resource.component";
import {AddResourceComponent} from "./component/add-resource/add-resource.component";
import {ApproveResourceComponent} from "./component/approve-resource/approve-resource.component";
import {LoginComponent} from "./component/login/login.component";
import {AuthGuard} from "./guard/auth.guard";
import {ChangePasswordComponent} from "./component/change-password/change-password.component";
import {HelpComponent} from "./component/help/help.component";
import {AppComponent} from "./app.component";
import {ETrainingComponent} from "./component/e-training/e-training.component";
import {RequestResourceComponent} from "./component/request-resource/request-resource.component";

const routes: Routes = [
  {path: '', component: HomeComponent, pathMatch: 'full'},
  {path: 'export', component: HomeComponent, pathMatch: 'full',data:{header:"none"}},
  {path: 'home', component: HomeComponent, pathMatch: 'full'},
  {path:'resource/approve', component:ApproveResourceComponent, pathMatch:'full',canActivate:[AuthGuard]},
  {path:'resource/add', component:AddResourceComponent, pathMatch:'full'},
  {path:'resource/request', component:RequestResourceComponent, pathMatch:'full'},
  {path:'resource/edit/:id',component:AddResourceComponent,pathMatch:'full',canActivate:[AuthGuard]},
  {path:'resource/:id/:lang', component:ResourceComponent, pathMatch:'full'},
  {path:'resource/:id', component:ResourceComponent, pathMatch:'full'},
  {path:'login', component:LoginComponent, pathMatch:'full'},
  {path:'help', component:HelpComponent, pathMatch:'full'},
  {path:'changePassword/:token', component:ChangePasswordComponent, pathMatch:'full'},
  {path:'e_training', component:ETrainingComponent, pathMatch:'full'}




];

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

}
