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

export const dynamic = "force-dynamic"

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