import { useIntl } from "react-intl"

import SidePeek from "@scandic-hotels/design-system/SidePeek"

import { RoomSidePeekContent } from "./RoomSidePeekContent"

import { SidePeekEnum } from "@/types/components/hotelReservation/sidePeek"
import type { RoomSidePeekProps } from "@/types/components/sidePeeks/roomSidePeek"

export default function RoomSidePeek({
  room,
  activeSidePeek,
  close,
}: RoomSidePeekProps) {
  const intl = useIntl()

  return (
    <SidePeek
      title={room.name}
      isOpen={activeSidePeek === SidePeekEnum.roomDetails}
      handleClose={close}
      closeLabel={intl.formatMessage({
        defaultMessage: "Close",
      })}
    >
      <RoomSidePeekContent room={room} />
    </SidePeek>
  )
}
