import { getSavedPaymentCardsSafely } from "@/lib/trpc/memoizedRequests"

import PaymentClient from "./PaymentClient"

import type { PaymentProps } from "@/types/components/hotelReservation/selectRate/section"

export default async function Payment({
  user,
  roomPrice,
  otherPaymentOptions,
  mustBeGuaranteed,
  supportedCards,
}: PaymentProps) {
  const savedCreditCards = await getSavedPaymentCardsSafely({
    supportedCards,
  })

  return (
    <PaymentClient
      user={user}
      roomPrice={roomPrice}
      otherPaymentOptions={otherPaymentOptions}
      savedCreditCards={savedCreditCards}
      mustBeGuaranteed={mustBeGuaranteed}
    />
  )
}
