"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuickSearchReducer = exports.QuickSearchReady = exports.QuickSearchSetStyle = exports.QuickSearchRun = exports.QUICK_SEARCH_READY = exports.QUICK_SEARCH_SET_STYLE = exports.QUICK_SEARCH_RUN = void 0;
const ReduxConstants_1 = require("../../Utilities/Constants/ReduxConstants");
const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
/**
 * @ReduxAction Runs Quick Search
 */
exports.QUICK_SEARCH_RUN = 'QUICK_SEARCH_RUN';
/**
 * @ReduxAction Sets Quick Search style
 */
exports.QUICK_SEARCH_SET_STYLE = 'QUICK_SEARCH_SET_STYLE';
/**
 * @ReduxAction Quick Search Module is ready
 */
exports.QUICK_SEARCH_READY = 'QUICK_SEARCH_READY';
const QuickSearchRun = (quickSearchText) => ({
    type: exports.QUICK_SEARCH_RUN,
    quickSearchText,
});
exports.QuickSearchRun = QuickSearchRun;
const QuickSearchSetStyle = (style) => ({
    type: exports.QUICK_SEARCH_SET_STYLE,
    style,
});
exports.QuickSearchSetStyle = QuickSearchSetStyle;
const QuickSearchReady = (quickSearchState) => ({
    type: exports.QUICK_SEARCH_READY,
    quickSearchState,
});
exports.QuickSearchReady = QuickSearchReady;
const initialState = {
    QuickSearchText: GeneralConstants_1.EMPTY_STRING,
    Style: {
        BackColor: ReduxConstants_1.QUICK_SEARCH_DEFAULT_BACK_COLOR,
        ForeColor: ReduxConstants_1.QUICK_SEARCH_DEFAULT_FORE_COLOR,
    },
};
const QuickSearchReducer = (state = initialState, action) => {
    switch (action.type) {
        case exports.QUICK_SEARCH_RUN:
            return Object.assign({}, state, {
                QuickSearchText: action.quickSearchText,
            });
        case exports.QUICK_SEARCH_SET_STYLE:
            return Object.assign({}, state, {
                Style: action.style,
            });
        default:
            return state;
    }
};
exports.QuickSearchReducer = QuickSearchReducer;
