import { getServerSession } from "next-auth";
import AdminPanel from "../../components/AdminPanel";
import { authOptions } from "../../lib/auth";

export default async function AdminPage() {
  const session = await getServerSession(authOptions);
  if (session?.user?.role !== "ADMIN") {
    return (
      <div className="rounded border border-dashed border-slate-300 bg-white p-8 text-center">
        <p className="text-slate-700">Nur fuer Admins.</p>
      </div>
    );
  }

  return <AdminPanel />;
}
