"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.setSearchToSelectVocabulary = exports.setSearchToSelectRecordType = exports.setSearchToSelectAdvanced = exports.setSearchToSelectKeyword = exports.clearSearchToSelect = void 0;

var _actionCodes = require("../constants/actionCodes");

var _reducers = require("../reducers");

const clearSearchToSelect = () => ({
  type: _actionCodes.CLEAR_SEARCH_TO_SELECT
});

exports.clearSearchToSelect = clearSearchToSelect;

const setSearchToSelectKeyword = value => ({
  type: _actionCodes.SET_SEARCH_TO_SELECT_KEYWORD,
  payload: value
});

exports.setSearchToSelectKeyword = setSearchToSelectKeyword;

const setSearchToSelectAdvanced = condition => (dispatch, getState) => {
  const recordType = (0, _reducers.getSearchToSelectRecordType)(getState());
  dispatch({
    type: _actionCodes.SET_SEARCH_TO_SELECT_ADVANCED,
    payload: condition,
    meta: {
      recordType
    }
  });
};

exports.setSearchToSelectAdvanced = setSearchToSelectAdvanced;

const setSearchToSelectRecordType = recordType => ({
  type: _actionCodes.SET_SEARCH_TO_SELECT_RECORD_TYPE,
  payload: recordType
});

exports.setSearchToSelectRecordType = setSearchToSelectRecordType;

const setSearchToSelectVocabulary = vocabulary => ({
  type: _actionCodes.SET_SEARCH_TO_SELECT_VOCABULARY,
  payload: vocabulary
});

exports.setSearchToSelectVocabulary = setSearchToSelectVocabulary;