import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
    },
    {
      path: '/training',
      name: 'training',
      component: () => import('../views/TrainingView.vue'),
    },
    {
      path: '/awards',
      name: 'awards',
      component: () => import('../views/AwardsView.vue'),
    },
    {
      path: '/anatomy',
      name: 'anatomy',
      component: () => import('../views/AnatomyView.vue'),
    },
    {
      path: '/biography/alexander',
      name: 'biography-alexander',
      component: () => import('../views/BiographyMaleView.vue'),
    },
    {
      path: '/biography/lyudmila',
      name: 'biography-lyudmila',
      component: () => import('../views/BiographyFemaleView.vue'),
    },
    {
      path: '/training/:slug',
      name: 'training-detail',
      component: () => import('../views/TrainingDetailView.vue'),
    },
    {
      path: '/anatomy/:slug',
      name: 'anatomy-detail',
      component: () => import('../views/AnatomyDetailView.vue'),
    },
  ],

  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    }
    return { top: 0, left: 0, behavior: 'smooth' }
  }
})

export default router
