var DEFAULT_VERSION = '1.1';

var defaultInheritList = new Array();
defaultInheritList[0] = 'Object';

var sparse = 'Sparse, only <code>id</code> will be set.';
var onlyreturn = 'This field will be returned <b>only</b> if available.';

function TransferObject(name, description, inheritList, idList, fieldList, since, toOptions, internal) {
  this.name = name;
  this.description = description;
  this.inheritList = inheritList == null ? defaultInheritList : inheritList;
  this.idList = idList;
  this.fieldList = fieldList;
  this.since = since == null ? DEFAULT_VERSION : since;
  this.toOptions = toOptions;
  this.internal = false;
}

function FieldObject(name, type, ref, description, settable, updated, internal) {
  this.name = name;
  this.type = type;
  this.ref = ref;
  this.description = description;
  this.settable = settable != null ? settable : true;
  this.updated = updated != null ? ("<br><em>[<span class='update'>Updated:</span> " + updated + ".]</em>") : updated;
  this.internal = internal == null ? false : internal;
}

function OptionObject(name, description, defaults, internal) {
  this.name = name;
  this.description = description;
  this.defaults = defaults == null ? true : defaults;
  this.internal = internal == null ? false : internal;
}

function jointos(prevto, newto) {
  var newarray = newto;
  for(var i = 0; i < prevto.length; i++) {
    var found = false;
    for(var j = 0; j < newto.length; j++) {
      if(newto[j].name == prevto[i].name) {
        found = true;
        break;
      }
    }
    if(!found)
      newarray[newarray.length] = prevto[i];
  }
  return newarray;
}