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

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import('@/views/Home.vue')
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('@/views/About.vue')
  },
  {
    path: '/map',
    name: 'map',
    component: () => import('@/views/MapView.vue')
  },
  {
    path: '/map-switch-demo',
    name: 'map-switch-demo',
    component: () => import('@/views/MapSwitchDemo.vue')
  },
  {
    path: '/image-overlay',
    name: 'image-overlay',
    component: () => import('@/views/ImageOverlayDemo.vue')
  }
]

const router = createRouter({
  history: createWebHistory(
    // 动态适配：微前端环境中使用主应用分配的 baseroute，独立运行时使用 '/'
    window.__MICRO_APP_BASE_ROUTE__ || '/'
  ),
  routes
})

export default router
