import React from 'react';
import { connect } from 'react-redux';
import DiagnosticItem from '@components/DiagnosticItem';
import { ADD_DIAGNOSTIC, GET_DIAGNOSTIC_STR } from '@store/types/diagnosticList'; 
import {  SHOW_SEARCH,  HIDE_SEARCH, SET_SEARCH_VALUE } from '@store/types/diagnosticSearch';
import { isChronicMag } from'@store/async-actions/diagnosticList.js';
import { addDiagnostic } from '@store/async-actions/treat';
import { getSearchResult } from '@store/async-actions/diagnosticSearch';
import {billing, getTips} from '../store/async-actions/pushMessage';


function mapStateToProps(state) {
    return {
        diagnosticList: state.diagnosticList.diagnosticList,
        mode:state.typeConfig.typeConfig
    }
}

function mapDispatchToProps(dispatch) {
    return{
        addDiagnostic: (item) => {
            dispatch(addDiagnostic(item))
            // dispatch({
            //     type: ADD_DIAGNOSTIC,
            //     item: item
            // });
            // dispatch({
            //     type: GET_DIAGNOSTIC_STR
            // });
        },
        showSearch:()=>{
            dispatch({
                type: SHOW_SEARCH
            })
        },
        hideSearch:()=>{
            dispatch({
                type: HIDE_SEARCH
            })
        },
        getTips: (diagItem) => {
            dispatch(getTips(diagItem))
        },
        isChronicMag: (item) =>{
            dispatch(isChronicMag(item))
        }
    }
}

const DiagnosticItemContainer = connect(
    mapStateToProps,
    mapDispatchToProps
)(DiagnosticItem);

export default DiagnosticItemContainer;