import { createRouter, createWebHistory } from 'vue-router';
import HomePage from '../components/HomePage.vue';
import MarkdownEditor from '../components/MarkdownEditor.vue';
import LoginPage from '../components/LoginPage.vue';
import RegisterPage from '../components/RegisterPage.vue';
import TrashPage from '../components/TrashPage.vue';

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: HomePage
  },
  {
    path: '/editor',
    name: 'Editor',
    component: MarkdownEditor
  },
  {
    path: '/editor/:id',
    name: 'EditMarkdown',
    component: MarkdownEditor,
    props: true
  },
  {
    path: '/login',
    name: 'Login',
    component: LoginPage
  },
  {
    path: '/register',
    name: 'Register',
    component: RegisterPage
  },
  {
    path: '/trash',
    name: 'Trash',
    component: TrashPage
  }
];

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

export default router;
