import { notFound } from "next/navigation";

import { DerivativeMasterForm } from "../_components/derivative-master-form/derivative-master-form";
import { fetchBackendDerivativeMasterDetail } from "../_lib/derivative-master-server-api";

type PageProps = {
  params: Promise<{ id: string }>;
};

export default async function DerivativeMasterUpdatePage({ params }: PageProps) {
  const { id } = await params;

  try {
    const row = await fetchBackendDerivativeMasterDetail(decodeURIComponent(id));
    return <DerivativeMasterForm mode="update" initialRow={row} />;
  } catch {
    notFound();
  }
}
