import React, { Component } from 'react';
import { connect } from 'react-redux';
import {bindActionCreators} from 'redux';
import {IoTyActions} from 'redux/modules/actions/IoTyActions';
import {AceEditorActions} from 'redux/modules/actions/AceEditorActions'
import {
	IoTyVLabContainer
} from 'components';


const mapStateToProps = (state) => ({
	IoTyvLab : state.IoTyvLab,
	aceEditorInfo : state.aceEditorInfo
});
const mapDispatchToProps = (dispatch) => ({
  IoTyActions: bindActionCreators(Object.assign({}, IoTyActions), dispatch),
  AceEditorActions : bindActionCreators(Object.assign({}, AceEditorActions), dispatch)
});

class IoTyLabView extends Component {
	constructor (props) {
		super(props);
	}
	componentDidMount() {
		//load existed circuit on breadboard
		// this.props.IoTyActions.getExistedCircuitData()

		//load new circuit data
		// this.props.IoTyActions.getNewCircuitData()

		this.props.IoTyActions.getLocalCircuitData()

		/*let requestObject = {
			vlqId : 282					//HARD CODED VALUE, REMOVE IT LATER
		}
		this.props.IoTyActions.getCircuitData(requestObject)*/
	}

	render() {
		let IoTyVLabContainerProps = {}
		IoTyVLabContainerProps.IoTyvLab = this.props.IoTyvLab
		IoTyVLabContainerProps.aceEditorInfo = this.props.aceEditorInfo
		IoTyVLabContainerProps.IoTyActions = this.props.IoTyActions
		IoTyVLabContainerProps.AceEditorActions = this.props.AceEditorActions
		return (
			<div>
				<IoTyVLabContainer {...IoTyVLabContainerProps}/>
			</div>
		);
	}
}

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