'use client';

import { createContext, useContext } from 'react';

export interface SrpMapFocusHotel {
  id: string;
  name: string;
  lat: number;
  lng: number;
}

interface SrpMapContextValue {
  openMapForHotel: (hotel: SrpMapFocusHotel) => void;
}

const SrpMapContext = createContext<SrpMapContextValue | null>(null);

export function SrpMapProvider({
  children,
  openMapForHotel,
}: {
  children: React.ReactNode;
  openMapForHotel: (hotel: SrpMapFocusHotel) => void;
}) {
  return (
    <SrpMapContext.Provider value={{ openMapForHotel }}>
      {children}
    </SrpMapContext.Provider>
  );
}

export function useSrpMap() {
  return useContext(SrpMapContext);
}
