import { createApp } from 'vue'
import { createRouter, createWebHashHistory } from 'vue-router'
import App from './App.vue'

import './styles/base.css'

import PatternLibrary from './views/PatternLibrary.vue'
import PreviewTheatre from './views/PreviewTheatre.vue'

const routes = [
  { path: '/',             redirect: '/patterns' },
  { path: '/patterns',     name: 'patterns',  component: PatternLibrary, meta: { title: 'Pattern Library' } },
  { path: '/patterns/:section', name: 'patterns-section', component: PatternLibrary, meta: { title: 'Pattern Library' } },
  { path: '/preview',      redirect: '/preview/JV-D1000' },
  { path: '/preview/:sku', name: 'preview',   component: PreviewTheatre, meta: { title: 'Preview Theatre' } }
]

const router = createRouter({
  history: createWebHashHistory('/editorial/'),
  routes,
  scrollBehavior: () => ({ top: 0 })
})

createApp(App).use(router).mount('#app')
