import React from 'react';
import { connect } from 'react-redux';
import Diagnosis from '@components/Diagnosis';
import { SHOW_SEARCH,  HIDE_SEARCH ,SHOW_TCM_SEARCH,HIDE_TCM_SEARCH} from '@store/types/diagnosticSearch';
import {HIDEDROP} from '@types/homePage';
import {embedPush} from '@store/async-actions/pushMessage';

function mapStateToProps(state) {//console.log(state)
    return {
        show: state.diagnosticSearch.show,
        showTcm: state.diagnosticSearch.showTcm,
        showSym: state.diagnosticSearch.showSym,
        tcmList:state.diagnosticList.tcmList,
        windowHeight:state.homePage.windowHeight,
        typeConfig: state.typeConfig
    }
}

function mapDispatchToProps(dispatch) {
    return {
        showSearch:()=>{
            dispatch({
                type: SHOW_SEARCH
            })
        },
        hideSearch:()=>{
            dispatch({
                type: HIDE_SEARCH
            })
        },
        showSymSearch:(flag)=>{
            dispatch({
                type: 'SHOW_SYM_SEARCH',
                show:flag
            })
        },
        showTcmSearch:()=>{
            dispatch({
                type: SHOW_TCM_SEARCH
            })
        },
        hideTcmSearch:()=>{
            dispatch({
                type: HIDE_TCM_SEARCH
            })
        },
        hideAllDrop(){
          dispatch({
            type:HIDEDROP
          });
        },
        getBilling: (obj) => {
            obj.action ='diag'
            dispatch(embedPush(obj))
        },
    }
}

const DiagnosisContainer = connect(
    mapStateToProps,
    mapDispatchToProps
)(Diagnosis)

export default DiagnosisContainer;

