// /redux/slices/currentPoiSlice.js
import { createSlice } from "@reduxjs/toolkit";

const initialState = {
  currentPoi: null,
};

const currentPoiSlice = createSlice({
  name: "currentPoi",
  initialState,
  reducers: {
    setCurrentPoi(state, action) {
      state.currentPoi = action.payload; // Zustand mit dem neuen POI aktualisieren
    },
    clearCurrentPoi(state) {
      state.currentPoi = null; // Zustand auf null zurücksetzen
    },
  },
});

// Actions exportieren
export const { setCurrentPoi, clearCurrentPoi } = currentPoiSlice.actions;

// Selector exportieren (optional)
export const selectCurrentPoi = (state) => state.currentPoi.currentPoi;

// Reducer exportieren
export default currentPoiSlice.reducer;
