// import {createRouter, createWebHistory} from '@ionic/vue-router';
import { createRouter, createWebHistory } from 'vue-router';
import layout from '@/layout/index.vue'

const routes = [
    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/Login/index.vue'),
    },
    {
        path: '/',
        redirect: '/home',
        component: layout,
        children: [
            {
                path: 'home',
                name: 'home',
                component: () => import('@/views/HomeView.vue'),
            },
            {
                path: 'map',
                name: 'map',
                component: () => import('@/views/Map/index.vue'),
            },
            {
                path: 'inspect',
                name: 'inspect',
                component: () => import('@/views/Inspect/index.vue'),
            },
            {
                path: 'inspect/:id/objects',
                name: 'inspectObjects',
                component: () => import('@/views/Inspect/Object/index.vue'),
            },
            {
                path: 'inspect/:id/object/:objId/problems',
                name: 'inspectObjectQuestions',
                component: () => import('@/views/Inspect/Object/Problem/index.vue'),
            },
            {
                path: 'problem',
                name: 'problem',
                component: () => import('@/views/Problem/index.vue'),
            },
            {
                path: 'problem/:id',
                name: 'problemDetail',
                component: () => import('@/views/Problem/detail/index.vue'),
            },
            {
                path: 'about',
                name: 'about',
                component: () => import('@/views/AboutView.vue'),
                meta: { title: '我的' }
            },
        ],
    },
];

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

export default router;
