import { createSlice } from "@reduxjs/toolkit";

const initialState = {
  isOpen: false,
  latlng: null,
};

const addPoiOnPolylineSlice = createSlice({
  name: "addPoiOnPolyline",
  initialState,
  reducers: {
    openAddPoiOnPolylineModal: (state, action) => {
      state.isOpen = true;
      state.latlng = action.payload;
    },
    closeAddPoiOnPolylineModal: (state) => {
      state.isOpen = false;
      state.latlng = null;
    },
  },
});

export const { openAddPoiOnPolylineModal, closeAddPoiOnPolylineModal } = addPoiOnPolylineSlice.actions;
export default addPoiOnPolylineSlice.reducer;
