import {connect} from 'react-redux';
import DIO from '../../components/AdminPage/DIO';
import {get_dio_info, get_dio_status, set_do_status, set_dio_info, clear_dio} from '../../actions';

const mapStateToProps = (state) => ({
	dio: state.lists.dio,
	i18n: state.i18n
});

const mapDispatchToProps = (dispatch, ownProps) => ({
	clearList: () => {
		dispatch(clear_dio());
	},
	getDIOInfo: () => {
		dispatch(get_dio_info());
	},
	getIO: () => {
		dispatch(get_dio_status());
	},
	dotRun: (pin, value) => {
		dispatch(set_do_status({
			pin,
			value
		}));
	},
	setDIOInfo: (data) => {
		dispatch(set_dio_info(data));
	}
})

export default connect(mapStateToProps, mapDispatchToProps)(DIO);