import {
    createMemoryHistory,
    createRouter as _createRouter,
    createWebHistory
} from 'vue-router'

export function createRouter() {
    return _createRouter({
        // use appropriate history implementation for server/client
        // import.meta.env.SSR is injected by Vite.
        history: import.meta.env.SSR ? createMemoryHistory() : createWebHistory(),
        routes: [{
            name: 'home',
            path: '/',
            component: () => import('./pages/index.vue')
        }, {
            name: 'close',
            path: '/close',
            component: () => import('./pages/close.vue')
        }, {
            name: 'nft',
            path: '/nft',
            redirect: { name: 'nft-list' },
            component: () => import('./pages/nft/index.vue'),
            children: [{
                name: 'nft-list',
                path: 'list',
                component: () => import('./pages/nft/list.vue')
            }, {
                name: 'nft-add',
                path: 'add',
                component: () => import('./pages/nft/add.vue')
            }]
        }]
    })
}
