import { createSlice } from "@reduxjs/toolkit";
import { appReducers } from "./appReducers";

const initialState = {
  pending: false,
  inActiveTime: 1800,
  modal: {
    modalState: false,
    modalContent: null,
    modalTitle: null,
    modalOnClose: null,
    modalSize: 500,
  },
  drawer: {
    top: false,
    left: false,
    bottom: false,
    right: false,
    content: null,
    title: null,
  },
};

const slice = createSlice({
  name: "app",
  initialState,
  reducers: appReducers,
  extraReducers: {},
});

export const { reducer: appSlice } = slice;

export const {
  LOADING_START,
  LOADING_END,
  CLOSE_MODAL,
  OPEN_MODAL,
  DRAWER,
  BACKDROP_SHOW,
  BACKDROP_HIDE,
  RESET_TIME_TO_LOGOUT,
} = slice.actions;
