export const showSearch = (state,action) => {
    const res = Object.assign({}, state);
    res.show = true;
    res.showTcm = false;
    res.showSym = false;
    return res;
}
export const hideAllSearch = (state) => {
    const res = Object.assign({}, state);
    res.show = false;
    res.showTcm = false;
    res.showSym = false;
    return res;
}
export const hideSearch = (state,action) => {
    const res = Object.assign({}, state);
    res.show = false;
    return res;
}
export const showTcmSearch = (state,action) => {
    const res = Object.assign({}, state);
    res.show = false;
    res.showSym = false;
    res.showTcm = true;
    return res;
}

export const showSymSearch = (state,action) => {
    const res = Object.assign({}, state);
    res.show = false;
    res.showTcm = false;
    res.showSym=action.show;
    return res;
}

export const hideTcmSearch = (state,action) => {
    const res = Object.assign({}, state);
    res.showTcm = false;
    return res;
}

export const setSearchValue = (state,action) => {
    const res = Object.assign({},state);
    res.searchValue = action.searchValue;
    return res;
}

export const getSearchResult= (state, action) => {
    const res = Object.assign({},state);
    let searchResult = []
    action.searchResult && action.searchResult.map((item, index) =>{
        let searchResultItem = {}
        searchResultItem.name = item.name
        searchResultItem.conceptId = item.conceptId
        searchResult.push(searchResultItem)
    }) 
    res.searchResult = searchResult;
    return res;
}


export const showText = (state, action) => {
  const res = Object.assign({}, state);
//   console.log(action,'action===============');
  res.isShowNoDataInfo = action.isShowNoDataInfo;
  return res;
};
