import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { TabsPage } from './tabs/tabs.page';
import { LearningPage } from './tab1/learning/learning.page'; // 导入学习页面
import { TestingPage } from './tab1/testing/testing.page'; // 导入在线测试页面
import { PlanningPage } from './tab1/planning/planning.page'; // 导入学习计划页面
import { QnaPage } from './tab1/qna/qna.page'; // 导入智能问答页面

export const routes: Routes = [
  {
    path: 'tabs',
    component: TabsPage,
    children: [
      {
        path: 'tab1',
        loadComponent: () => import('./tab1/tab1.page').then(m => m.Tab1Page),
      },
      {
        path: 'tab2',
        loadComponent: () => import('./tab2/tab2.page').then(m => m.Tab2Page),
      },
      {
        path: 'tab3',
        loadComponent: () => import('./tab3/tab3.page').then(m => m.Tab3Page),
      },
      {
        path: 'tab4',
        loadComponent: () => import('./tab4/tab4.page').then(m => m.Tab4Page),
      },
      {
        path: '',
        redirectTo: 'tab1',
        pathMatch: 'full',
      },
    ]
  },
  {
    path: 'learning',
    loadComponent: () => import('./tab1/learning/learning.page').then(m => m.LearningPage),
  },
  {
    path: 'testing',
    loadComponent: () => import('./tab1/testing/testing.page').then(m => m.TestingPage),
  },
  {
    path: 'planning',
    loadComponent: () => import('./tab1/planning/planning.page').then(m => m.PlanningPage),
  },
  {
    path: 'qna',
    loadComponent: () => import('./tab1/qna/qna.page').then(m => m.QnaPage),
  },
  {
    path: '',
    redirectTo: '/tabs/tab1',
    pathMatch: 'full',
  },
];

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