"use strict";

var SharedConstants = require('../constants/SharedConstants');
var _ = require('lodash/lang');
var UtilDocumentId = require('../../shared/utils/UtilDocumentId');

const lodashCloneDeep = require('lodash.clonedeep');

module.exports = {
    // get initial version, ready to insert
    createVersion: function (document) {

        if (document == null || document.documentId == null) {
            return null;
        }

        var version = lodashCloneDeep(document);

        if (version._id)
            delete version._id;

        version.systemHeader.currentVersion = false;

        return version;

    }
};
