import type { JSX } from "react"
import { getTranslations } from "next-intl/server"
import { ExamRichForm } from "@/modules/exams/components/exam-rich-form"
import { requirePermission } from "@/shared/lib/auth-guard"
import { Permissions } from "@/shared/types/permissions"

export const dynamic = "force-dynamic"

export default async function NewExamPage(): Promise<JSX.Element> {
  await requirePermission(Permissions.EXAM_CREATE)
  const t = await getTranslations("examHomework")
  return (
    <div className="mx-auto w-full max-w-[1400px] space-y-6 p-6">
      <div>
        <h1 className="text-2xl font-bold tracking-tight">{t("exam.richEditor.title")}</h1>
        <p className="text-muted-foreground">{t("exam.richEditor.description")}</p>
      </div>
      <ExamRichForm />
    </div>
  )
}
