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

export const routes: Routes = [
  {
      path: '',
      component: TabsPage,
      children: [
        {
          path: 'home',
          loadComponent: () => import('./pages/home/home.page').then((m) => m.HomePage)
        },
        {
          path: 'feed',
          loadComponent: () => import('./pages/feed/feed.page').then((m) => m.FeedPage)
        },
        {
          path: 'profile',
          loadComponent: () => import('./pages/profile/profile.page').then((m) => m.ProfilePage),
          canActivate: [authGuard]
        },
        {
          path: 'login',
          loadComponent: () => import('./pages/login/login.page').then((m) => m.LoginPage)
        },
        {
          path: 'register',
          loadComponent: () => import('./pages/register/register.page').then((m) => m.RegisterPage)
        },
        {
          path: '',
          redirectTo: 'home',
          pathMatch: 'full',
        },
      ]
  },
  {
    path: '',
    redirectTo: 'home',
    pathMatch: 'full'
  }
];
