// /components/mainComponent/hooks/useInitializeMap.js
import { useEffect } from "react";
import { initializeMap } from "../../../utils/initializeMap";

const useInitializeMap = (map, mapRef, setMap, setOms, setMenuItemAdded, addItemsToMapContextMenu, hasRights, setPolylineEventsDisabled) => {
  useEffect(() => {
    if (mapRef.current && !map) {
      initializeMap(mapRef, setMap, setOms, setMenuItemAdded, addItemsToMapContextMenu, hasRights, setPolylineEventsDisabled);
    }
  }, [mapRef, map, hasRights, setPolylineEventsDisabled]);
};

export default useInitializeMap;
