import { localizedMetadata } from "@/lib/i18n/serverMetadata";
import type { Metadata } from "next";
import ProtectedRoute from "@/components/shared/ProtectedRoute";
import RegisterListForLearnandServe from "@/features/opportunities/components/RegisterListForLearnandServe";

const pageMetadata: Metadata = {
  title: "Development registrations",
  /* Signed-in or terminal screen: nothing here is useful in search
     results, and these routes ship their HTML to anyone because the
     guards are client-side. */
  robots: { index: false, follow: false },
};

export async function generateMetadata(): Promise<Metadata> {
  return localizedMetadata(pageMetadata);
}

/*
 * Guarded, to match its already-guarded sibling.
 *
 * This screen reads an authenticated endpoint, so an anonymous visitor reached
 * it and got a blank screen rather than a redirect — the data never arrived,
 * nothing said why, and there was no way on from there. The sibling route for
 * the other opportunity type has carried this guard all along; the gap was an
 * omission, not a decision.
 *
 * The guard is client-side and runs after hydration, so it is a UX redirect,
 * not a security boundary — only the backend token check keeps the data out of
 * an anonymous reader's hands, and it already does.
 */
export default function Page() {
  return (
    <ProtectedRoute userType={["volunteer", "organization"]}>
      <RegisterListForLearnandServe />
    </ProtectedRoute>
  );
}
