import { redirect } from "next/navigation";
import AdminShell from "@/components/admin/AdminShell";
import MediaManager from "@/components/admin/MediaManager";
import { requireAdminSession } from "@/lib/admin/auth";
import { listMediaFiles } from "@/lib/admin/media";

export default async function AdminMediaPage() {
  if (!await requireAdminSession()) redirect("/admin/login");
  const files = await listMediaFiles();

  return (
    <AdminShell>
      <div className="admin-page-head">
        <p className="eyebrow">Assets</p>
        <h1>Medienverwaltung</h1>
      </div>
      <MediaManager initialFiles={files} />
    </AdminShell>
  );
}
