import type { Metadata } from "next"
import type { JSX } from "react"
import { getTranslations } from "next-intl/server"

import { requirePermission } from "@/shared/lib/auth-guard"
import { Permissions } from "@/shared/types/permissions"
import { AdminSettingsView } from "@/modules/settings/components/admin-settings-view"

export async function generateMetadata(): Promise<Metadata> {
  const t = await getTranslations("settings")
  return {
    title: `${t("admin.title")} - Next_Edu`,
    description: t("admin.description"),
  }
}

export const dynamic = "force-dynamic"

export default async function AdminSettingsPage(): Promise<JSX.Element> {
  await requirePermission(Permissions.SETTINGS_ADMIN)
  return (
    <div className="flex h-full flex-col p-8">
      <AdminSettingsView />
    </div>
  )
}
