import BlogListView from '@/views/blog/BlogListView.vue';
import BlogView from '@/views/blog/BlogView.vue';
import BlogEditorView from '@/views/blog/BlogEditorView.vue';

export default [
  { path: '/blogs/create', name: 'BlogCreate', component: BlogEditorView, meta: { requiresAuth: true } },
  { path: '/blogs/:id/edit', name: 'BlogEdit', component: BlogEditorView, props: true, meta: { requiresAuth: true } },
  // Slug-only route first so it doesn't get captured by the :id route
  { path: '/blogs/:slug', name: 'BlogSlug', component: BlogView, props: route => ({ slug: route.params.slug }) },
  // Id-constrained route (numeric id only) with optional slug for canonical links
  { path: '/blogs/:id(\\d+)/:slug?', name: 'Blog', component: BlogView, props: true },
  { path: '/blogs', name: 'BlogList', component: BlogListView },
];
