import SuccessMessageCard from "@/components/sections/SubscribePage/SuccessPage/SuccessMessageCard";
import SubscriptionSummaryCard from "@/components/sections/SubscribePage/SuccessPage/SubscriptionSummaryCard";
import SuccessPageActions from "@/components/sections/SubscribePage/SuccessPage/SuccessPageActions";
import { Suspense } from "react";

interface SuccessPageProps {
  searchParams: Promise<Record<string, string | string[] | undefined>>;
}

export default async function SuccessPage({ searchParams }: SuccessPageProps) {
  // Trial sign-ups land here directly (no payment) with ?trial
  const isTrial = "trial" in (await searchParams);

  return (
    <section className="container-padding-x py-8 flex flex-col gap-5 sm:gap-10">
      <SuccessMessageCard isTrial={isTrial} />
      <Suspense fallback={<div>Loading summary...</div>}>
        <SubscriptionSummaryCard />
      </Suspense>
      <SuccessPageActions isTrial={isTrial} />
    </section>
  );
}
