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

interface LoopChartTypeState {
  chartTitle: "Messkurve" | "Meldungen";
}

const initialState: LoopChartTypeState = {
  chartTitle: "Messkurve", // Standard: Messkurve
};

const loopChartTypeSlice = createSlice({
  name: "loopChartType",
  initialState,
  reducers: {
    setChartTitle: (
      state,
      action: PayloadAction<"Messkurve" | "Meldungen">
    ) => {
      state.chartTitle = action.payload;
    },
  },
});

export const { setChartTitle } = loopChartTypeSlice.actions;
export default loopChartTypeSlice.reducer;
