import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import {TabsPage} from "./tabs/tabs.page";
import {AppComponent} from "./app.component";

const routes: Routes = [
  {
    path: 'tabs',
    component: TabsPage,
    children: [
      {path: 'home', children: [{path: '', loadChildren: './tabs/home/home.module#HomePageModule'}]},
      {path: 'discover', children: [{path: '', loadChildren: './tabs/discover/discover.module#DiscoverPageModule'}]},
      {path: 'serve', children: [{path: '', loadChildren: './tabs/serve/serve.module#ServePageModule'}]},
      {path: 'mine', children: [{path: '', loadChildren: './tabs/mine/mine.module#MinePageModule'}]},
      {path: '', redirectTo: '/tabs/home', pathMatch: 'full'}
    ]
  },
  {
    path: 'login', children: [{path: '', loadChildren: './tabs/login/login.module#LoginPageModule'}],
  },
  {
    path: '',
    redirectTo: '/tabs/home',
    pathMatch: 'full'
  },
  {path:'*',component:AppComponent,}
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule {}
