import { createContext, useContext } from "react"

import type { RoomContextValue } from "@/types/contexts/details/room"

export const RoomContext = createContext<RoomContextValue | null>(null)

export function useRoomContext() {
  const ctx = useContext(RoomContext)
  if (!ctx) {
    throw new Error("Missing context value [RoomContext]")
  }
  return ctx
}
