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

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: 'picture',
        loadComponent: () =>
          import('../poem-picture/poem-picture.component').then((m) => m.PoemPictureComponent),
      },
      {
        path: 'inquiry/ai',
        loadComponent: () =>
          import('../page/page-inquiry/page-inquiry.component').then((m) => m.PageInquiryComponent),
      },
      {
        path: 'inquiry/human',
        loadComponent: () =>
          import('../page/inquiry-human/inquiry-human.component').then((m) => m.InquiryHumanComponent),
      },
      {
        path: 'page-test',
        loadComponent: () =>
          import('../page-test/page-test.component').then((m) => m.PageTestComponent),
      },
      {
        path: 'my-health', // 我的健康
        loadComponent: () =>
          import('../page/page-my-health/page-my-health.component').then((m) => m.PageMyHealthComponent),
      },

      {
        path: 'drug-category/:name',
        loadComponent: () =>
          import('../drug-category/drug-category.page').then(
            (m) => m.DrugCategoryPage
          ),
      },
      {
        path: 'create-agent',
        loadComponent: () =>
          import('../page/page-create-agent/page-create-agent.component').then(
            (m) => m.PageCreateAgentComponent
          ),
      },
      {
        path: 'user',
        loadComponent: () =>
          import('../page/page-user-inquery/page-user-inquery.component').then(
            (m) => m.PageUserInqueryComponent
          ),
      },
      {
        path: 'help',
        loadComponent: () =>
          import('../page/feedback-help/feedback-help.component').then(
            (m) => m.FeedbackHelpComponent
          ),
      },
      {
        path: 'password',
        loadComponent: () =>
          import('../page/change-key/change-key.component').then(
            (m) => m.ChangeKeyComponent
          ),
      },
      {
        path: 'weather-time',
        loadComponent: () =>
          import('../page/time-weather/time-weather.component').then(
            (m) => m.TimeWeatherComponent
          ),
      },
      {
        path: 'guide',
        loadComponent: () =>
          import('../page/guide/guide.component').then(
            (m) => m.GuideComponent
          ),
      },
      {
        path: '',
        redirectTo: '/tabs/tab1',
        pathMatch: 'full'
      },
    ],
  },
  {
    path: '',
    redirectTo: '/tabs/tab1',
    pathMatch: 'full'
  }
];

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