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

// Pages
import NoteListPage from './pages/NoteListPage.vue'
import NoteDetailPage from './pages/NoteDetailPage.vue'
import NoteEditorPage from './pages/NoteEditorPage.vue'
import FolderPage from './pages/FolderPage.vue'
import SettingsPage from './pages/SettingsPage.vue'

// Router
const routes = [
  { path: '/', redirect: '/notes' },
  { path: '/notes', component: NoteListPage },
  { path: '/notes/:id', component: NoteDetailPage, props: true },
  { path: '/editor', component: NoteEditorPage },
  { path: '/editor/:id', component: NoteEditorPage, props: true },
  { path: '/folders', component: FolderPage },
  { path: '/settings', component: SettingsPage }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

// App
const app = createApp(App)
app.use(createPinia())
app.use(router)
app.mount('#app')