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

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    name: 'Home',
    component: () => import('@/pages/HomePage.vue')
  },
  {
    path: '/project/:id',
    name: 'Project',
    component: () => import('@/pages/ProjectPage.vue'),
    children: [
      {
        path: '',
        redirect: to => `/project/${String(to.params.id)}/files`
      },
      {
        path: 'files',
        name: 'ProjectFiles',
        component: () => import('@/pages/ProjectFilePage.vue')
      },
      {
        path: 'split',
        name: 'ProjectSplit',
        component: () => import('@/pages/ProjectTextSplitPage.vue')
      },
      {
        path: 'questions',
        name: 'ProjectQuestions',
        component: () => import('@/pages/ProjectQuestionPage.vue')
      },
      {
        path: 'datasets',
        name: 'ProjectDatasets',
        component: () => import('@/pages/ProjectDatasetPage.vue')
      },
      {
        path: 'eval',
        name: 'ProjectEval',
        component: () => import('@/pages/ProjectEvalPage.vue')
      },
      {
        path: 'settings',
        name: 'ProjectSettings',
        component: () => import('@/pages/ProjectSettingsPage.vue')
      }
    ]
  },
  {
    path: '/models',
    name: 'ModelSettings',
    component: () => import('@/pages/ModelSettingsPage.vue')
  },
  {
    path: '/crawler',
    name: 'Crawler',
    component: () => import('@/pages/CrawlerPage.vue')
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
