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

const pageMetadata: Metadata = {
  title: "Edit development opportunity",
  /* 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);
}

export default async function Page({
  params,
}: {
  params: Promise<{ id: string }>;
}) {
  const { id } = await params;

  return (
    <ProtectedRoute publish={["development", "internship"]} publishIntent="edit">
      <LearnServeForm opportunityId={id} />
    </ProtectedRoute>
  );
}
