import { Routes } from '@angular/router';
import { authGuard } from './guards/auth.guard';

export const routes: Routes = [
  { path: '', pathMatch: 'full', redirectTo: '/catalog' },
  {
    path: 'auth',
    loadChildren: () => import('./pages/auth/auth.routes').then(m => m.AUTH_ROUTES)
  },
  {
    path: 'catalog',
    loadChildren: () => import('./pages/catalog/catalog.routes').then(m => m.CATALOG_ROUTES),
    canActivate: [authGuard]
  },
  {
    path: 'my-courses',
    loadChildren: () => import('./pages/my-courses/my-courses.routes').then(m => m.MY_COURSES_ROUTES),
    canActivate: [authGuard]
  },
  {
    path: 'create',
    loadChildren: () => import('./pages/course-editor/course-editor.routes').then(m => m.COURSE_EDITOR_ROUTES),
    canActivate: [authGuard]
  },
  {
    path: 'courses/:id',
    loadChildren: () => import('./pages/course-viewer/course-viewer.routes').then(m => m.COURSE_VIEWER_ROUTES),
    canActivate: [authGuard]
  },
  {
    path: 'courses/:id/edit',
    loadChildren: () => import('./pages/course-editor/course-editor.routes').then(m => m.COURSE_EDITOR_ROUTES),
    canActivate: [authGuard]
  }
];
