import { createSlice, PayloadAction } from "@reduxjs/toolkit";

interface ConfirmModalState {
  open: boolean;
}

const initialState: ConfirmModalState = {
  open: false,
};

export const confirmModalSlice = createSlice({
  name: "confirmModal",
  initialState,
  reducers: {
    openConfirmModal: (state) => {
      state.open = true;
    },
    closeConfirmModal: (state) => {
      state.open = false;
    },
    setConfirmModal: (state, action: PayloadAction<boolean>) => {
      state.open = action.payload;
    },
  },
});

export const { openConfirmModal, closeConfirmModal, setConfirmModal } =
  confirmModalSlice.actions;
export default confirmModalSlice.reducer;
