"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.alertsSlice = void 0;
const uuid_1 = require("uuid");
const toolkit_1 = require("@reduxjs/toolkit");
const react_core_1 = require("@patternfly/react-core");
const initialState = [];
exports.alertsSlice = (0, toolkit_1.createSlice)({
    initialState,
    name: 'alerts',
    reducers: {
        addAlert: (state, action) => [
            Object.assign({ key: action.payload.key || (0, uuid_1.v4)(), variant: react_core_1.AlertVariant.danger }, action.payload),
            ...state,
        ],
        removeAlert: (state, action) => state.filter((alert) => alert.key !== action.payload),
        clearAlerts: () => initialState,
    },
});
//# sourceMappingURL=alertsSlice.js.map