var React = require('react');
var LocoBusinessActionCreator = require('../actions/LocoBusinessActionCreator');

var Business = React.createClass({

  getInitialState: function() {
    return {
      business: this.props.data
    };
  },
  render: function() {
    return (
      <div
        id= 'business-{this.state.business.id}'
        className='loco-business'
        onClick={this._onClick}>
      {this.state.business.name}
      <small>
        &nbsp;({this.state.business.type})
      </small>
      </div>
    );
  },
  _onClick: function(event) {
    LocoBusinessActionCreator.clickedBusiness(this.props.data.id);
  }
});

module.exports = Business;
