import type { Metadata } from "next";
import DirectPayClient from "./DirectPayClient";

export const dynamic = "force-dynamic";

type Params = { params: Promise<{ orderId: string }> };

export async function generateMetadata({ params }: Params): Promise<Metadata> {
  const { orderId } = await params;
  return {
    title: `Pay for order ${orderId} — The Swiss Laundry`,
    description: "Secure OTP-verified payment for your Swiss Laundry order.",
    robots: { index: false, follow: false },
  };
}

export default async function DirectPayPage({ params }: Params) {
  const { orderId } = await params;
  const decoded = decodeURIComponent(orderId || "").trim();

  return <DirectPayClient orderId={decoded} />;
}
