"use client"

import { notFound } from "next/navigation"

import { ArticleCreateForm } from "@/components/articles/create/article-create-form"
import {
  getArticleCreateMeta,
  isArticleCreateSection,
} from "@/components/articles/data/article-section-meta"

type CreateArticlePageProps = {
  section: string
}

export function CreateArticlePage({ section }: CreateArticlePageProps) {
  if (!isArticleCreateSection(section)) {
    notFound()
  }

  const meta = getArticleCreateMeta(section)

  if (!meta) {
    notFound()
  }

  return <ArticleCreateForm meta={meta} />
}
