import React from 'react';
import { connect } from 'react-redux';
import CheckBox from '@commonComp/CheckBox';
import {CONFIRN_CHECKBOX,CLEAR_CHECKBOX,SHOW_CHECKBOX,CHECKED,FIRST,THEN,NOSPECIAL} from '@store/types/checkBox';


function mapStateToProps(state){
  return{
    showCheckBox:state.checkBox.showCheckBox,
    selectVal:state.checkBox.selectVal,
    isClear:state.checkBox.isClear,
    firstC:state.checkBox.firstC,
    thenC:state.checkBox.thenC,
    thenArr:state.checkBox.thenArr,
    firstArr:state.checkBox.firstArr,
    change:state.checkBox.change,
    noSpecial:state.checkBox.noSpecial,//无殊选中
    noSpecialFlag:state.checkBox.noSpecialFlag,//互斥
  }
}


function mapDispatchToProps (dispatch){
  return{
    handleCheckBoxClick:(info)=>{//点击复选框标签
        dispatch({
          type:CHECKED,
          value:info
        })
      },
    showBox:(info)=>{//点击症状标签
      dispatch({
        type:SHOW_CHECKBOX,
        showCheckBox:info
      })
    },
    clearCheckBox:(info)=>{//清空
      dispatch({
        type:CLEAR_CHECKBOX,
        checkBoxId:info.checkBoxId
      })
    },
    confirmCheckBox:(info)=>{//确定
      dispatch({
        type:CONFIRN_CHECKBOX,
        checkBoxId:info.checkBoxId
      })
    },
    firstChoo:(info)=>{//初为
      dispatch({
        type:FIRST,
        change:info
      })
    },
    thenChoo:(info)=>{//后为
      dispatch({
        type:THEN,
        change:info
      })
    },
    noSpecialClick:()=>{//点击无殊
      dispatch({
        type:NOSPECIAL
      })
    }
  }
}


const CheckBoxContainer = connect(
    mapStateToProps,
    mapDispatchToProps
)(CheckBox);
export default CheckBoxContainer;
