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

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Home',
      component: () => import('@/views/Home/index.vue'),
    },
    {
      path: '/gantt',
      name: 'Gantt',
      component: () => import('@/views/Gantt'),
      redirect: '/gantt/main',
      children: [
        {
          path: 'main',
          name: 'MainGantt',
          component: () => import('@/views/Gantt/components/MainGantt'),
        },
        {
          path: 'sub/:subId',
          name: 'SubGantt',
          component: () => import('@/views/Gantt/components/SubGantt'),
        },
        {
          path: 'mainEdit',
          name: 'MainGanttEdit',
          component: () => import('@/views/Gantt/components/MainGanttEdit'),
        },
        {
          path: 'subEdit/:subId',
          name: 'SubGanttEdit',
          component: () => import('@/views/Gantt/components/SubGanttEdit'),
        },
      ],
    },
  ],
})

export default router
