var Table = React.createClass({
  // TODO: Declare all propTypes
  propTypes: {
    title: React.PropTypes.string,
    id: React.PropTypes.number,
    url: React.PropTypes.string
  },

  getInitialState: function() {
    return {
      data: null,
      id: "",
      title: ""
    };
  },

  componentDidMount: function() {
    $.getJSON(this.props.url, function(result) {
      if (this.isMounted()) {
        this.setState({ data: result });
      }
    }.bind(this));
  },

  render: function() {
    if (!this.state.data) {
      return <div>Loading...</div>;
    }
    return (
      <div id={"table-" + this.state.data.id}>
        <h1>{this.state.data.title}</h1>
        <Seat />
        <Seat />
        <Seat />
        <Seat />
      </div>
    );
  }
});
