import { createRouter, createWebHistory } from 'vue-router'
import BrowseView from '@/views/BrowseView.vue'
import HomeMedia from '@/components/HomeMedia.vue'
import MediaGrid from '@/components/MediaGrid.vue'
import SearchMedia from '@/components/SearchMedia.vue'
import ItemView from '@/views/ItemView.vue'
import VideoView from '@/views/VideoView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'browse',
      component: BrowseView,
      redirect: '/home',
      children: [
        {
          path: 'home',
          component: HomeMedia,
        },
        {
          path: 'search',
          component: SearchMedia,
        },
        {
          path: 'view/:id',
          component: MediaGrid,
          meta: {
            transition: 'slide-right',
          },
        },
      ],
    },
    {
      path: '/item',
      redirect: '/home',
      children: [
        {
          path: ':id',
          component: ItemView,
        },
      ],
    },
    {
      path: '/play',
      redirect: '/home',
      children: [
        {
          path: ':id',
          component: VideoView,
        },
      ],
      meta: {
        hideMenu: true,
      },
    },
    {
      path: '/login',
      name: 'login',
      component: () => import(/* webpackChunkName: 'login' */ '@/views/LoginView.vue'),
      meta: {
        hideMenu: true,
      },
    },
  ],
})

export default router
