"use client"
import { useIntl } from "react-intl"

import { dt } from "@/lib/dt"

import { CreditCardAddIcon } from "@/components/Icons"
import Button from "@/components/TempDesignSystem/Button"
import Body from "@/components/TempDesignSystem/Text/Body"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
import useLang from "@/hooks/useLang"
import { formatPrice } from "@/utils/numberFormatting"

import styles from "./paymentDetails.module.css"

import type { BookingConfirmationPaymentDetailsProps } from "@/types/components/hotelReservation/bookingConfirmation/paymentDetails"

export default function PaymentDetails({
  booking,
}: BookingConfirmationPaymentDetailsProps) {
  const intl = useIntl()
  const lang = useLang()
  return (
    <div className={styles.details}>
      <Subtitle color="uiTextHighContrast" type="two">
        {intl.formatMessage({ id: "Payment details" })}
      </Subtitle>
      <div className={styles.payment}>
        <Body color="uiTextHighContrast">
          {formatPrice(intl, booking.totalPrice, booking.currencyCode)}{" "}
          {intl.formatMessage({ id: "has been paid" })}
        </Body>
        <Body color="uiTextHighContrast">
          {dt(booking.createDateTime)
            .locale(lang)
            .format("ddd D MMM YYYY, hh:mm")}
        </Body>
        <Body color="uiTextHighContrast">
          {intl.formatMessage(
            { id: "{card} ending with {cardno}" },
            { card: "N/A", cardno: "N/A" }
          )}
        </Body>
      </div>
      <Button
        className={styles.btn}
        intent="text"
        size="small"
        theme="base"
        variant="icon"
        wrapping
      >
        <CreditCardAddIcon />
        {intl.formatMessage({ id: "Save card to profile" })}
      </Button>
    </div>
  )
}
