"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConstantEntityPersistence = void 0;
const __1 = require("..");
const internal_1 = require("../../internal");
class ConstantEntityPersistence {
    static fromData(ctx, object) {
        const constantEntity = ctx.corpus.MakeObject(internal_1.cdmObjectType.constantEntityDef, object.constantEntityName);
        if (object.explanation) {
            constantEntity.explanation = object.explanation;
        }
        if (object.constantValues) {
            constantEntity.constantValues = object.constantValues;
        }
        constantEntity.entityShape = __1.CdmFolder.EntityReferencePersistence.fromData(ctx, object.entityShape);
        return constantEntity;
    }
    static toData(instance, resOpt, options) {
        return {
            explanation: instance.explanation,
            constantEntityName: instance.constantEntityName,
            entityShape: instance.entityShape ? instance.entityShape.copyData(resOpt, options) : undefined,
            constantValues: instance.constantValues
        };
    }
}
exports.ConstantEntityPersistence = ConstantEntityPersistence;
//# sourceMappingURL=ConstantEntityPersistence.js.map