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

const routes = [
  {
    path: '/',
    name: 'player',
    component: () => import('../views/PlayerView.vue'),
  },
  {
    path: '/piece/:id',
    name: 'piece',
    component: () => import('../views/PlayerView.vue'),
    props: (route) => ({ id: Number(route.params.id) }),
  },
  {
    path: '/upload',
    name: 'upload',
    component: () => import('../views/UploadView.vue'),
  },
  {
    path: '/piece/:id/edit',
    name: 'edit',
    component: () => import('../views/EditView.vue'),
    props: (route) => ({ id: Number(route.params.id) }),
  },
]

export default createRouter({
  history: createWebHistory(),
  routes,
})
