// Not to mix with `DataSnapshots` class which is about different thing
// (serialized list views updated reactively)
//
// This one is about snaphots of data made in specific moments of time.
// Snaphots are not reactive in any way. They're updated only if given specific moment repeats
// for entity it refers to.
// e.g. We want to store a state of submitted dataForms at business process at its submission
// After it's stored it's not updated (and safe against any external changes like model changes)
// Just in case of re-submissions (e.g. return of file from sent back case) the snapshot is
// overwritten with regenerated value

'use strict';

var memoize    = require('memoizee/plain')
  , ensureDb   = require('dbjs/valid-dbjs')
  , extendBase = require('../../base');

module.exports = memoize(function (db) {
	extendBase(ensureDb(db));
	return db.Object.extend('DataSnapshot', {
		jsonString: { type: db.String }
		// 'resolved' property evaluation is configured in ./resolve.js
	});
}, { normalizer: require('memoizee/normalizers/get-1')() });

@@ -922,74 +922,366 @@
 ng %7D
+,
 %0A%09%09// 
-'resolved' property evaluation is configured in ./resolve.js
+Generates snapshot (if it was not generated already)%0A%09%09generate: %7B type: db.Function, value: function (ignore) %7B%0A%09%09%09if (!this.jsonString) this.regenerate();%0A%09%09%7D %7D,%0A%09%09// Generates snapshot (overwrites old snapshot if it exist)%0A%09%09regenerate: %7B type: db.Function, value: function (ignore) %7B%0A%09%09%09this.jsonString = JSON.stringify(this.owner.toJSON());%0A%09%09%7D %7D
 %0A%09%7D)

Introduce `generate` and `regenerate` methods