import { notFound } from "next/navigation";
import { getOfferEditorData, getOfferFieldOptions } from "@/lib/offer-queries";
import { OfferEditorClient } from "@/components/admin/offers/OfferEditorClient";

export const revalidate = 0;

export default async function OfferEditPage({
  params,
}: {
  params: Promise<{ id: string }>;
}) {
  const { id } = await params;
  const [data, options] = await Promise.all([
    getOfferEditorData(id),
    getOfferFieldOptions(),
  ]);

  if (!data) {
    notFound();
  }

  return <OfferEditorClient data={data} fieldOptions={options} />;
}
