"use client"

import useSidePeekStore from "@/stores/sidepeek"

import { ExpandIcon } from "@/components/Icons"
import Button from "@/components/TempDesignSystem/Button"

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

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

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

  return (
    <Button
      onClick={() =>
        openSidePeek({
          key: SidePeekEnum.bookedRoomDetails,
          hotelId,
          roomTypeCode,
          user,
          confirmationNumber,
        })
      }
      theme="base"
      size="small"
      variant="icon"
      intent="text"
      wrapping
    >
      <div className={styles.iconContainer}>
        <ExpandIcon />
      </div>
    </Button>
  )
}
