import type { Component } from 'vue'

interface ChlidrenRoute {
  path: string
  name: string
  component: () => Promise<Component>
  props?: boolean
}
interface Route {
  path: string
  name: string
  component: () => Promise<Component>
  props?: boolean
  children?: ChlidrenRoute[]
}

const routes: Route[] = [
  {
    path: '/',
    name: 'home',
    component: () => import('@/pages/mainPage/indexPage.vue'),
  },
  {
    path: '/books/:slug',
    name: 'book-detail',
    component: () => import('@/pages/books/_slug/indexBookPage.vue'),
    props: true,
    children: [
      {
        path: ':titlesSlug',
        name: 'book-titles',
        component: () => import('@/pages/books/_slug/_titlesSlug/indexTitlesPage.vue'),
      },
    ],
  },
  {
    path: '/privacy',
    name: 'privacy',
    component: () => import('@/pages/privacy/privacyPage.vue'),
  },
]

export default routes
