// import { Suspense } from "react";
// import VerifyClient from "@/components/VerifyClient";

// export default function Page() {
//   return (
//     <Suspense fallback={<div>Loading...</div>}>
//       <VerifyClient />
//     </Suspense>
//   );
// }

import type { Metadata } from "next";
import VerifyClient from "@/components/VerifyClient";
import Script from "next/script";

export async function generateMetadata(): Promise<Metadata> {
  return {
    title: "Verify OTP",
    description:
      "Verify your OTP to securely login or sign up on Ridoo and continue booking bikes and cars.",

    alternates: {
      canonical: "/verify-otp", // ✅ clean URL (no params)
    },

    openGraph: {
      title: "OTP Verification - Ridoo",
      description:
        "Enter OTP to securely access your Ridoo account.",
      url: "/verify-otp",
      siteName: "Ridoo",
      type: "website",
    },

    // 🔥 VERY IMPORTANT
    robots: {
      index: false, // ❌ do not index
      follow: true,
    },
  };
}

export default async function Page({
  searchParams,
}: {
  searchParams: Promise<any>;
}) {
  const params = await searchParams; // 🔥 IMPORTANT

  console.log("SERVER PARAMS 👉", params);

  const getParam = (param: any) =>
    Array.isArray(param) ? param[0] : param || "";

  const phone = getParam(params?.phone);
  const redirect = getParam(params?.redirect) || "/";
  const order_id = getParam(params?.order_id);

  return (
    <>
    <Script
  id="verify-schema"
  type="application/ld+json"
  dangerouslySetInnerHTML={{
    __html: JSON.stringify({
      "@context": "https://schema.org",
      "@type": "WebPage",
      name: "OTP Verification",
      description: "OTP verification page for secure login",
    }),
  }}
/>

<VerifyClient
      phone={phone}
      redirect={redirect}
      order_id={order_id}
    />

    </>
    
  );
}