import { SHOW_SEARCH,  HIDE_SEARCH, SHOW_TCM_SEARCH,  HIDE_TCM_SEARCH, SET_SEARCH_VALUE, GET_SEARCH_RESULT,SHOWNODATATEXT } from '../types/diagnosticSearch';
import { showSearch,hideAllSearch,  hideSearch,showTcmSearch,hideTcmSearch, setSearchValue, getSearchResult,showText,showSymSearch } from '../actions/diagnosticSearch';

const initState = {
  show: false,
  showTcm: false,
  showSym:false,
  searchValue: '',
  searchResult: [],
  isShowNoDataInfo: false
};

export default function (state=initState, action) {
    switch(action.type) {
        case SHOW_SEARCH:
            return showSearch(state, action);
        case HIDE_SEARCH: 
            return hideSearch(state, action);
        case 'SHOW_SYM_SEARCH':
            return showSymSearch(state, action);
        case 'HIDE_ALL_SEARCH':
            return hideAllSearch(state);
        case SHOW_TCM_SEARCH:
            return showTcmSearch(state, action);
        case HIDE_TCM_SEARCH:
            return hideTcmSearch(state, action);
        case SET_SEARCH_VALUE: 
            return setSearchValue(state, action);
        case GET_SEARCH_RESULT: 
            return getSearchResult(state, action);
        case SHOWNODATATEXT: 
            return showText(state, action);
        default: 
            return state;
    }
}
