import {createSlice} from '@reduxjs/toolkit';

const initialState = {
    modalVisible: false,
    selectedUser: null,
};

const adminSlice = createSlice({
    name: 'adminUI',
    initialState,
    reducers: {
        setSelectedUser(state, action) {
            state.selectedUser = action.payload;
        },
        openModal(state) {
            state.modalVisible = true;
        },
        closeModal(state) {
            state.modalVisible = false;
        },
    },
});

export const {
    openModal,
    closeModal,
    setSelectedUser,
} = adminSlice.actions;

export default adminSlice.reducer;