// /rdux/slices/lineVisibilitySlice.js
import { createSlice } from "@reduxjs/toolkit";

const initialState = {
  activeLines: {}, // Speichert `idLD -> Active`
};

const lineVisibilitySlice = createSlice({
  name: "lineVisibility",
  initialState,
  reducers: {
    updateLineStatus(state, action) {
      const { idLD, active } = action.payload;
      state.activeLines[idLD] = active; // Speichert `idLD` in Redux
    },
    setActiveLines(state, action) {
      state.activeLines = action.payload;
    },
  },
});

export const { updateLineStatus, setActiveLines } = lineVisibilitySlice.actions;
export default lineVisibilitySlice.reducer;
