// import type { RouteRecordRaw } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'

// const modules: Record<string, { default: RouteRecordRaw }> = import.meta.glob('./routes/*.ts', { eager: true })
// const routes = Object.values(modules).map(module => module.default)

// console.debug('routes :>> ', routes)

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('~/pages/txwx.index.vue'),
    },
    {
      path: '/txwx-detail',
      name: 'txwx-detail',
      component: () => import('~/pages/txwx.detail.vue'),
    },
    // {
    //   path: '/',
    //   name: 'home',
    //   component: () => import('~/pages/index.vue'),
    // },
    {
      path: '/school',
      name: 'school',
      component: () => import('~/pages/school.vue'),
    },
    {
      path: '/teaching',
      name: 'teaching',
      component: () => import('~/pages/teaching.vue'),
    },
    {
      path: '/teacher',
      name: 'teacher',
      component: () => import('~/pages/teacher.vue'),
    },
    {
      path: '/student',
      name: 'student',
      component: () => import('~/pages/student.vue'),
    },
  ],
})

export default router

router.beforeEach((to, from) => {
  console.groupCollapsed(`%c${from.name?.toString()} => ${to.name?.toString()}`, 'color:#0ff')
  console.log(`%c${from.meta.title} => ${to.meta.title}`, 'color:#0cc')
  console.groupEnd()
})
