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

import { notifyAction } from '@/modules/@common/notify/redux/slices';

const initialState = {
  message: '',
  loading: false,
};

export const slice = createSlice({
  name: '@layout',
  initialState,
  reducers: {
    messageAction: (state, action) => {
      state.message = action.payload || initialState.message;
    },
    loadingAction: (state, action) => {
      state.loading = action.payload || initialState.loading;
    },
    followToHelpLinkAction: (state) => state,
  },
});

export const { messageAction, loadingAction, followToHelpLinkAction } = slice.actions;

export const showNotificationAction = notifyAction;

export const nameSpace = slice.name;

export default slice.reducer;
