// (C) 2025-2026 GoodData Corporation
import { areObjRefsEqual } from "@gooddata/sdk-model";
const setShowWidgetAsTable = (state, action) => {
    state.widgetRefs = action.payload;
};
const clearShowWidgetAsTable = (state) => {
    state.widgetRefs = [];
};
const addWidgetToShowAsTable = (state, action) => {
    if (!state.widgetRefs.some((ref) => areObjRefsEqual(ref, action.payload))) {
        state.widgetRefs.push(action.payload);
    }
};
const removeWidgetToShowAsTable = (state, action) => {
    state.widgetRefs = state.widgetRefs.filter((ref) => !areObjRefsEqual(ref, action.payload));
};
export const showWidgetAsTableReducers = {
    setShowWidgetAsTable,
    clearShowWidgetAsTable,
    addWidgetToShowAsTable,
    removeWidgetToShowAsTable,
};
