var AttributeList    = require('./AttributeList');

var Item = module.exports = function Item(attributes) {
  this.attributes = new AttributeList(attributes);
  this.properties = {
    byteRange     : null,
    discontinuity : null,
    duration      : null,
    title         : null,
    uri           : null
  };
};

Item.prototype.get = function get(key) {
  if (this.propertiesHasKey(key)) {
    return this.properties[key];
  } else {
    return this.attributes.get(key);
  }
};

Item.prototype.set = function set(key, value) {
  if (this.propertiesHasKey(key)) {
    this.properties[key] = value;
  } else {
    this.attributes.set(key, value);
  }

  return this;
};

Item.prototype.serialize = function serialize() {
  return {
    attributes  : this.attributes.serialize(),
    properties  : this.properties
  }
};

Item.unserialize = function unserialize(constructor, object) {
  var item = new constructor;
  item.attributes = AttributeList.unserialize(object.attributes);
  item.properties = object.properties;
  return item;
};

Item.prototype.setData = function setData(data) {
  var self = this;
  Object.keys(data).forEach(function(key) {
    self.set(key, data[key]);
  });
};

Item.prototype.propertiesHasKey = function hasKey(key) {
  return Object.keys(this.properties).indexOf(key) > -1;
};
@@ -196,24 +196,50 @@
     : null,%0A
+    date          : null,%0A
     disconti
@@ -1326,12 +1326,13 @@
 ey) %3E -1;%0A%7D;
+%0A

Add date to the list of properties for Item