"use client"

import { useIntl } from "react-intl"

import useSidePeekStore from "@/stores/sidepeek"

import ChevronRight from "@/components/Icons/ChevronRight"
import Button from "@/components/TempDesignSystem/Button"

import { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek"
import { ToggleSidePeekProps } from "@/types/components/hotelReservation/toggleSidePeekProps"

export default function ToggleSidePeek({
  hotelId,
  roomTypeCode,
}: ToggleSidePeekProps) {
  const intl = useIntl()
  const openSidePeek = useSidePeekStore((state) => state.openSidePeek)

  return (
    <Button
      onClick={() =>
        openSidePeek({ key: SidePeekEnum.roomDetails, hotelId, roomTypeCode })
      }
      theme="base"
      size="small"
      variant="icon"
      intent="text"
      wrapping
    >
      {intl.formatMessage({ id: "See room details" })}{" "}
      <ChevronRight height="14" />
    </Button>
  )
}
