import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { LoginComponent } from './login/login.component';
import { OverzichtWervenComponent } from './authenticated/overzicht-werven/overzicht-werven.component';
import { GrondwaterstandComponent } from './authenticated/grondwaterstand/grondwaterstand.component';
import { LogComponent } from './authenticated/admin/log/log.component';
import { DebietComponent } from './authenticated/debiet/debiet.component';
import { StatusComponent } from './authenticated/status/status.component';
import { WerfFormComponent } from './authenticated/admin/werf-form/werf-form.component';
import { WerfFormTwoComponent } from './authenticated/admin/werf-form-two/werf-form-two.component';
import { WerfFormThreeComponent } from './authenticated/admin/werf-form-three/werf-form-three.component';
import { AutoAansturingComponent } from './authenticated/auto-aansturing/auto-aansturing.component';
import { WerfFormFourComponent } from './authenticated/admin/werf-form-four/werf-form-four.component';
import { NotfoundComponent } from './notfound/notfound.component';
import { AuthGuard } from '@auth0/auth0-angular';
import { ProfileComponent } from './authenticated/profile/profile.component';


const routes: Routes = [
  { path: '', component: LoginComponent },
  { path: 'overzicht_werven', component: OverzichtWervenComponent, canActivate: [AuthGuard]},
  { path: 'grondwaterstand', component: GrondwaterstandComponent, canActivate: [AuthGuard]},
  { path: 'profile', component: ProfileComponent, canActivate: [AuthGuard]},
  { path: 'grondwaterstand/:wharIid', component: GrondwaterstandComponent, canActivate: [AuthGuard]},
  { path: 'debiet', component: DebietComponent, canActivate: [AuthGuard]},
  { path: 'debiet/:wharIid', component: DebietComponent, canActivate: [AuthGuard]},
  { path: 'status', component: StatusComponent, canActivate: [AuthGuard]},
  { path: 'status/:wharIid', component: StatusComponent, canActivate: [AuthGuard]},
  { path: 'log/:wharIid', component: LogComponent, canActivate: [AuthGuard], data: {
    allowedRoles: ['admin']
  }},
  { path: 'admin/werf/form', component: WerfFormComponent, canActivate: [AuthGuard] },
  { path: 'admin/werf/form2/:wharfIid', component: WerfFormTwoComponent, canActivate: [AuthGuard] },
  { path: 'admin/werf/form3/:wharfIid', component: WerfFormThreeComponent, canActivate: [AuthGuard] },
  { path: 'admin/werf/form4/:wharfIid', component: WerfFormFourComponent, canActivate: [AuthGuard] },
  { path: 'auto/:wharIid', component: AutoAansturingComponent, canActivate: [AuthGuard]},
  { path: '404', component: NotfoundComponent},
  { path: '**', redirectTo: '/404'},
];

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