import type { Metadata } from "next";
import { redirect } from "next/navigation";
import { auth } from "@/lib/auth";

export const metadata: Metadata = {
  title: "Manage Profile",
  robots: { index: false, follow: false },
};

// 11+ pages under /manage/* are "use client" with no useSession check. The
// layout-level guard catches all of them at once, redirecting unauthenticated
// visitors before any management UI renders.
export default async function ManageLayout({ children }: { children: React.ReactNode }) {
  const session = await auth();
  if (!session?.user) redirect("/login");
  return children;
}
