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

export default async function AdminPage() {
  const session = await getServerSession(authOptions);
  if (session?.user?.role !== "ADMIN" && session?.user?.role !== "SUPERADMIN") {
    return (
      <div className="card-muted text-center">
        <p className="text-slate-700">Nur für Admins.</p>
      </div>
    );
  }

  return (
    <div className="space-y-6">
      <AdminPanel />
      {session?.user?.role === "SUPERADMIN" && <AdminSystemSettings />}
    </div>
  );
}
