import { Routes } from '@angular/router';
import { HomeComponent } from './routes/home/home.component';
import { PostComponent } from './routes/post/post.component';
import { DashboardComponent } from './routes/dashboard/dashboard.component';
import { LoggedInGuard } from './shared/guards/logged-in.guard';
import { PostEditorComponent } from './components/post-editor/post-editor.component';
import { CreatePostComponent } from './routes/post/create-post/create-post.component';
import { UpdatePostComponent } from './routes/post/update-post/update-post.component';

export const routes: Routes = [
  { path: '', component: HomeComponent },
  {
    path: 'post',
    children: [
      { path: 'new', component: CreatePostComponent },
      { path: ':id/edit', component: UpdatePostComponent },
      {
        path: ':id',
        component: PostComponent,
      },
    ],
  },
  {
    path: 'dashboard',
    component: DashboardComponent,
    canActivate: [LoggedInGuard],
  },
  { path: 'tst', component: PostEditorComponent },
];
