/**
 * User actions
 */
import * as types from './types';

export const loadingStartRequest = () => ({
  type: types.LOADING_START
});

export const loadingStopRequest = () => ({
  type: types.LOADING_STOP
});

export function requestNavigateToHome(user: any) {
  return {
    type: types.NAVIGATE_TO_HOME,
    payload: { user }
  };
}

export const goBackRequest = () => ({
  type: types.GO_BACK
});

export const navigateToBookRequestDetails = (filterParams?: any) => {
  return {
    type: types.NAVIGATE_TO_BOOK_REQUEST_DETAILS,
    payload: { filterParams }
  };
};

export function showEditModalRequest() {
  return {
    type: types.SHOW_EDIT_MODAL,
    payload: { editModalVisible: true }
  };
}

export function hideEditModalRequest() {
  return {
    type: types.HIDE_EDIT_MODAL,
    payload: { editModalVisible: false }
  };
}

export function showDeleteModalRequest() {
  return {
    type: types.SHOW_DELETE_MODAL,
    payload: { deleteModalVisible: true }
  };
}

export function hideDeleteModalRequest() {
  return {
    type: types.HIDE_DELETE_MODAL,
    payload: { deleteModalVisible: false }
  };
}

export const getCountryListRequest = () => ({
  type: types.GET_COUNTRY_LIST_REQUEST,
  payload: {}
});

export const getCountryListSuccess = (countryList: any) => ({
  type: types.GET_COUNTRY_LIST_SUCCESS,
  payload: { countryList }
});

export const getCountryListFail = (message: any) => ({
  type: types.GET_COUNTRY_LIST_FAIL,
  payload: { message }
});
