import { getTranslations } from "next-intl/server";
import AdminContent from "@/components/admin/admin-content";
import { authOptions } from "@/lib/auth/auth-options";
import { isAdminRole } from "@/lib/auth/roles";
import { getServerSession } from "next-auth";
import { notFound } from "next/navigation";

export async function generateMetadata() {
  const t = await getTranslations();
  return {
    title: `${t("admin.title")} | Suggest Bet`,
    description:
      "Admin panel for managing users, monitoring predictions, and system overview.",
  };
}

export default async function AdminPage() {
  const session = await getServerSession(authOptions);

  if (!isAdminRole(session?.user?.roles)) {
    notFound();
  }

  return <AdminContent />;
}
