import { getSavedPaymentCardsSafely } from "../../../trpc/memoizedRequests/getSavedPaymentCardsSafely"
import PaymentClient from "./PaymentClient"

import type { PaymentMethodEnum } from "@scandic-hotels/common/constants/paymentMethod"

type PaymentProps = {
  otherPaymentOptions: PaymentMethodEnum[]
  supportedCards: PaymentMethodEnum[]
}

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

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