// Data transfer
tkts.data = {};

//
// DATA STRUCTURE
//

// Create an order object
//    prices: the prices data for the show
// performance: the performance data for the show
tkts.data.Show = function(company, prices, performances) {
  this.company = company;
  this.prices = prices;
  this.performances = performances;
};

// Find a performance by its id, we assume it's unique.
//   id: the performance id.
tkts.data.Show.prototype.findPerformance = function(id) {
  for (var i=0, len=this.performances.length; i < len; ++i) {
    var p = this.performances[i];
    if (p.id == id) {
      return p;
    }
  }
  return null;
};

// Find a section by its id an performance.
//   id: the section id
tkts.data.Show.prototype.findSection = function(p, id) {
  for (var i=0, len=p.seatings.length; i < len; ++i) {
    var s = p.seatings[i];
    if (s.id == id) {
      return s;
    }
  }
  return null;
};

