// /redux/slices/kueChartModeSlice.ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit";

interface KueChartModeState {
  activeMode: "Schleife" | "TDR"; // 🔥 Zustand für den aktiven Modus
  selectedSlot: number | null; // 🔥 Neu: Aktuell gewählter Slot
}

const initialState: KueChartModeState = {
  activeMode: "Schleife", // Standard ist Schleife
  selectedSlot: null, // Standard: Kein Slot ausgewählt
};

export const kueChartModeSlice = createSlice({
  name: "kueChartModeSlice",
  initialState,
  reducers: {
    setActiveMode: (state, action: PayloadAction<"Schleife" | "TDR">) => {
      state.activeMode = action.payload; // 🔥 Speichert den Modus (Schleife oder TDR)
    },
    setSelectedSlot: (state, action: PayloadAction<number>) => {
      state.selectedSlot = action.payload; // 🔥 Speichert den aktiven Slot
    },
  },
});

export const { setActiveMode, setSelectedSlot } = kueChartModeSlice.actions;
export default kueChartModeSlice.reducer;
