import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {AppLoginComponent} from "./app.login.component";
import {AppIndexComponent} from "./app.index.component";
import {PersonPageComponent} from "./person/person.page.component";
import {PersonService} from "./person/person.service";
import {PrivotalPageComponent} from "./org/privotal.page.component";


const routes: Routes = [
  {path: 'frei', component: AppIndexComponent},
  {path: 'login', component: AppLoginComponent},
  {path: 'personal', component: PersonPageComponent, canActivate: [PersonService], canActivateChild: [PersonService]},
  {path: 'privotal', component: PrivotalPageComponent, canActivate: [PersonService], canActivateChild: [PersonService]},
  {path: '', redirectTo: 'frei', pathMatch: 'full'},
];

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