'use strict';
module.exports = Document;
var Modifier = require('./modifier');

/**
 * Change-tracked object.
 * The resultant object behaves as an ordinary object,
 * except that changes can be tracked internally via the use of a Modifier instance.
 * @param {Object} values initial values
 * @param {Schema} schema only keys defined in the schema are used
 */
function Document(values, schema) {
  var modifier = new Modifier(this);

  // Copy values and set initial state (everything is a change, not persisted yet)
  modifier.init(values || {}, schema);

  // Prevent new properties from being added.
  Object.freeze(this);
}

Document.prototype.inspect = function () {
  var modifier = new Modifier(this);
  var fields = modifier.fields;
  var relations = modifier.relations;
  var o = {};
  for (var k in fields) {
    if (Object.hasOwnProperty.call(fields, k)) {
      o[k] = fields[k];
    }
  }
  for (var kr in relations) {
    if (Object.hasOwnProperty.call(relations, kr)) {
      var v = relations[kr];
      o[k] = v;
    }
  }
  return o;
};

@@ -990,13 +990,13 @@
     
-var v
+o%5Bkr%5D
  = r
@@ -1013,24 +1013,8 @@
 r%5D;%0A
-      o%5Bk%5D = v;%0A
     

Fix variable name in #inspect