import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { AuthGuard } from './services/auth.service';

import { LoginComponent } from './components/login/login.component';
import { SignupComponent } from './components/singup/singup.component';

import { BoilerplateListComponent } from './components/boilerplate-list/boilerplate-list.component';
import { BoilerplateDetailsComponent } from './components/boilerplate-details/boilerplate-details.component';
import { AddBoilerplateComponent } from './components/add-boilerplate/add-boilerplate.component';
import { GroupboilComponent } from './components/groupboil/groupboil.component';
import { AddGroupboilComponent } from './components/add-groupboil/add-groupboil.component';
import { InstancesListComponent } from './components/instances-list/instances-list.component';


const routes: Routes = [
  { path: '', redirectTo: 'groupboilerplates', pathMatch: 'full' },
  { path: 'login', component: LoginComponent },
  { path: 'signup', component: SignupComponent },
  { path: 'groupboilerplates', component: GroupboilComponent, canActivate: [AuthGuard] },
  { path: 'groupboilerplates/:gb/boilerplates', component: BoilerplateListComponent, canActivate: [AuthGuard] },
  { path: 'groupboilerplates/:gb/boilerplates/details/:id', component: BoilerplateDetailsComponent, canActivate: [AuthGuard] },
  { path: 'groupboilerplates/:gb/boilerplates/add-boilerplate', component: AddBoilerplateComponent, canActivate: [AuthGuard] },
  { path: 'groupboilerplates/add-groupboil', component: AddGroupboilComponent, canActivate: [AuthGuard] },
  { path: '**', redirectTo: 'groupboilerplates'}
  //{ path: 'dictionary', component: InstancesListComponent, canActivate: [AuthGuard] }
];


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