import * as types from './types';

const messageError = message => ({
  type: types.NOTICE_MESSAGE_ERROR,
  message: message,
});

const messageSuccess = message => ({
  type: types.NOTICE_MESSAGE_SUCCESS,
  message: message,
});

const messageRemove = message => ({
  type: types.NOTICE_MESSAGE_REMOVE,
  message: message,
});

const messageClear = () => ({
  type: types.NOTICE_MESSAGE_CLEAR
});

const showError = (message) => (dispatch) => dispatch(messageError(message));
const showSuccess = (message) => (dispatch) => dispatch(messageSuccess(message));
const removeMessage = (message) => (dispatch) => dispatch(messageRemove(message));
const clearMessage = () => (dispatch) => dispatch(messageClear());

export { showError, showSuccess, removeMessage, clearMessage };
