import { Routes } from '@angular/router';

import { AuthGuard } from './core/guards/auth.guard';

import { LoginComponent } from './login/login.component';
import { SigninComponent } from './signin/signin.component';
import { HomeComponent } from './home/home.component';
import { DisconnectionComponent } from './disconnection/disconnection.component';
import { MyPostsComponent } from './posts/myPosts/my-posts.component';
import { AccountSettingsComponent } from './account-settings/account-settings.component';
import { ChangePasswordComponent } from './account-settings/change-password/change-password.component';
import { ProfilEditionComponent } from './account-settings/profil-edition/profil-edition.component';
import { PostComponent } from './posts/post.component';
import { ByCategoryComponent } from './posts/byCategory/by-category.component';
import { CreateUpdatePostComponent } from './posts/create-update/create-update-post.component';
import { VersionRevisionComponent } from './version-revisions/version-revisions.component';
import { HealthCheckComponent } from './health-check/health-check.component';
import { SearchComponent } from './search/search.component';

export const appRoutes: Routes = [
	{ path: 'login', component: LoginComponent },
	{ path: 'signin', component: SigninComponent },
	{ path: 'home', component: HomeComponent },
	{ path: 'disconnection', component: DisconnectionComponent },
	{ path: 'posts/new', component: CreateUpdatePostComponent, canActivate: [AuthGuard] },
	{ path: 'posts/update/:postKey', component: CreateUpdatePostComponent, canActivate: [AuthGuard] },
	{ path: 'posts/:postKey', component: PostComponent },
	{ path: 'posts/byCategory/:categoryId', component: ByCategoryComponent},
	{ path: 'posts/search/:searchCriteria', component: SearchComponent },
	{ path: 'myPosts', component: MyPostsComponent, canActivate: [AuthGuard] },
	{ path: 'accountSettings', component: AccountSettingsComponent, canActivate: [AuthGuard] },
	{ path: 'changePassword', component: ChangePasswordComponent, canActivate: [AuthGuard] },
	{ path: 'profilEdit', component: ProfilEditionComponent, canActivate: [AuthGuard] },
	{ path: 'versionrevisions', component: VersionRevisionComponent },
	{ path: 'healthCheck', component: HealthCheckComponent },
	{ path: '', redirectTo: '/home', pathMatch: 'full' },
	{ path: '**', redirectTo: '/home' }
];
