import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { LoginComponent } from './components/login/login.component';
import { PagesComponent } from './components/pages/pages.component';
import { AboutUsComponent } from './static-pages/about-us/about-us.component';
import { HomeComponent } from './static-pages/home/home.component';
import {FormComponent} from "./static-pages/form/form.component";
import {RegisterComponent} from "./components/register/register.component";
import {AccountActivateComponent} from "./components/account-activate/account-activate.component";
import {UpdateComponent} from "./components/update/update.component";
import {ChangepasswordComponent} from "./components/changepassword/changepassword.component";
import {LoginOidComponent} from "./components/login-oid/login-oid.component";
import {AuthGuard} from "./guards/auth.guard";


const routes: Routes = [
  { path: '', component: HomeComponent },
  { path: 'login', component: LoginComponent },
  { path: 'login-oid', component: LoginOidComponent },
  { path: 'account/activate/:code', component: AccountActivateComponent },
  { path: 'register', component: RegisterComponent },
  { path: 'update', component: UpdateComponent },
  { path: 'my-personal-data', component: UpdateComponent },
  { path: 'changepassword', component: ChangepasswordComponent },
  { path: 'pages', component: PagesComponent },
  { path: 'about-us', component: AboutUsComponent },
  { path: 'pages/:slug', component: PagesComponent, canActivate:  [AuthGuard]},
  { path: 'pages/edit/:id', component: PagesComponent, canActivate:  [AuthGuard] },
  { path: 'pages/view/:id', component: PagesComponent, canActivate:  [AuthGuard]},
  { path: 'form/:code', component: FormComponent, canActivate:  [AuthGuard] },
];

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