import { useTripStore, useAllMapMarkers, useActiveDayMapMarkers } from '@/store/useTripStore';

export const useTripMap = () => {
  const allMapMarkers = useAllMapMarkers();
  const activeDayMapMarkers = useActiveDayMapMarkers();
  const setSelectedPlaceId = useTripStore(state => state.setSelectedPlaceId);
  const setHoveredPlaceId = useTripStore(state => state.setHoveredPlaceId);
  const setHighlightedPlaceId = useTripStore(state => state.setHighlightedPlaceId);

  const onMarkerClick = (markerId: string) => {
    setSelectedPlaceId(markerId);
  };

  const onMarkerHover = (markerId: string | null) => {
    setHoveredPlaceId(markerId);
  };

  const highlightPlace = (placeId: string | null) => {
    setHighlightedPlaceId(placeId);
  };

  return {
    allMapMarkers,
    activeDayMapMarkers,
    onMarkerClick,
    onMarkerHover,
    highlightPlace,
  };
};
