import { createRouter, createWebHistory } from '@ionic/vue-router';
import { RouteRecordRaw } from 'vue-router';
import TabsPage from '../views/TabsPage.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/tabs/tab1'
  },
  {
    path: '/tabs/',
    component: TabsPage,
    children: [
      {
        path: '',
        redirect: '/tabs/tab1'
      },
      {
        path: 'tab1',
        component: () => import('@/views/Tab1Page.vue')
      },
      {
        path: 'tab2',
        component: () => import('@/views/Tab2Page.vue')
      },
      {
        path: 'tab3',
        component: () => import('@/views/Tab3Page.vue')
      },
      {
        path: 'tab4',
        component: () => import('@/views/ProfilePage.vue')
      },
      {
        path: 'detail/:id/',
        name: 'Detail', 
        component: () => import('@/views/DetailPage.vue')
      },
      {
        path: 'course_detail/:id/',
        name: 'course_detail', 
        component: () => import('@/views/CourseDetailPage.vue')
      },
      {
        path: 'mat_detail/:id/',
        name: 'mat_detail', 
        component: () => import('@/views/CourseMatDetailPage.vue')
      },
      {
        path: 'search_page/',
        name: 'search_page', 
        component: () => import('@/views/SearchPage.vue')
      },
      {
        path: 'signup/',
        name: 'signup', 
        component: () => import('@/views/SignupPage.vue')
      },
      {
        path: 'resetpass/',
        name: 'resetpass', 
        component: () => import('@/views/ResetPassPage.vue')
      },
      {
        path: 'post_detail/:id/',
        name: 'post_detail', 
        component: () => import('@/views/PostDetailPage.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
