import type { Metadata } from "next";
import { CheckoutContent } from "./components/CheckoutContent";
import { TrustRow } from "../components/TrustRow";
import { Footer } from "../components/Footer";
import { getShippingMethods, getPaymentMethods, getCartTrustBadges, getShippingSettings } from "../lib/payload";

// robots: noindex — transactional page, same reasoning as /cart.
export const metadata: Metadata = {
  title: "Checkout",
  description: "Schließe deine Bestellung bei einfach produktiv ab.",
  robots: {
    index: false,
    follow: true,
  },
};

export default async function CheckoutPage() {
  const [shippingMethods, paymentMethods, trustBadges, shippingSettings] = await Promise.all([
    getShippingMethods(),
    getPaymentMethods(),
    getCartTrustBadges(),
    getShippingSettings(),
  ]);

  return (
    <>
      <main className="flex flex-col flex-1 bg-bg-base">
        <CheckoutContent
          shippingMethods={shippingMethods}
          paymentMethods={paymentMethods}
          trustBadges={trustBadges}
          shippingSettings={shippingSettings}
        />
        <TrustRow />
      </main>
      <Footer />
    </>
  );
}
