import { Routes,mapToCanActivate } from '@angular/router';
import { TabsComponent } from '../modules/tabs/tabs/tabs.component';
import { AuthGuard } from '../services/auth.guard';

export const routes: Routes = [
  { path: '', redirectTo:'tabs', pathMatch: "full",}, // 默认跳转到 ''
  // {
  //   path: 'test',
  //   loadComponent:()=> import('../modules/test/page-test/page-test.component').then((mod) => mod.PageTestComponent),
  // },
  {
    path: 'login',
    loadComponent:()=> import('../modules/login/login.component').then((mod) => mod.LoginComponent),
  },
  {
    path: 'tabs', //首页tabs
    component: TabsComponent,
    canActivate: mapToCanActivate([AuthGuard]),
    loadChildren: () =>import('../modules/tabs/tabs.modules.routes').then((mod) => mod.TabsRoutingModule),
  },
  {
    path: 'user', 
    canActivate: mapToCanActivate([AuthGuard]),
    loadChildren: () =>import('../modules/user/user.modules.routes').then((mod) => mod.UserRoutingModule),
  },
  {
    path: 'account', 
    canActivate: mapToCanActivate([AuthGuard]),
    loadChildren: () =>import('../modules/account/account.modules.routes').then((mod) => mod.AccountRoutingModule),
  },
  {
    path: 'goods', 
    canActivate: mapToCanActivate([AuthGuard]),
    loadChildren: () =>import('../modules/goods/goods.modules.routes').then((mod) => mod.GoodsRoutingModule),
  },
  {
    path: 'live', 
    canActivate: mapToCanActivate([AuthGuard]),
    loadChildren: () =>import('../modules/live/live.modules.routes').then((mod) => mod.LiveRoutingModule),
  },
  
];
