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

// 초기 렌더링 속도를 위해 지연 로딩 사용
const routes = [
    {
        path: '/',
        component: () => import('@v/MainView.vue'),
        // meta: { requiresAuth: true }
    },
    {
        path: '/board',
        component: () => import('@v/board/TheBoard.vue'),
        children: [
            {
                path: '',
                name: 'BoardList',
                component: () => import('@v/board/BoardList.vue')
            },
            {
                path: 'write',
                component: () => import('@v/board/BoardWrite.vue')
            },
            {
                path: ':id',
                name: 'BoardDetail',
                component: () => import('@v/board/BoardView.vue')
            },
            {
                path: 'edit/:id',
                name: 'BoardEdit',
                component: () => import('@v/board/BoardEdit.vue')
            }
        ]
    },
    {
        path: '/wordDict',
        component: () => import('@v/wordDict/wordDict.vue'),
    },
    {
        path: '/login',
        component: () => import('@v/user/TheLogin.vue'),
        meta: { layout: 'NoLayout' },
    },
    {
        path: '/vacation',
        component: () => import('@v/vacation/VacationManagement.vue'),
    },
    {
        path: '/register',
        component: () => import('@v/user/TheRegister.vue'),
        meta: { layout: 'NoLayout' },
    },
    {
        path: '/voteboard',
        component: () => import('@v/voteboard/TheVoteBoard.vue'),
        children: [
            {
                path: '',
                component: () => import('@v/voteboard/voteBoardList.vue')
            },
            {
                path: 'write',
                component: () => import('@v/voteboard/voteboardWrite.vue')
            },

        ]
    },
    {
        path: '/sample',
        component: () => import('@c/calendar/SampleCalendar.vue'),
    },
    {
        path: "/:anything(.*)",
        component: () => import('@v/ErrorPage.vue'),
    }
];

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

export default router
