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

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