"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.AttributeGroupReferencePersistence = void 0;
const internal_1 = require("../../internal");
const __1 = require("..");
const cdmObjectRefPersistence_1 = require("./cdmObjectRefPersistence");
class AttributeGroupReferencePersistence extends cdmObjectRefPersistence_1.cdmObjectRefPersistence {
    static fromData(ctx, object, entityName) {
        if (!object) {
            return;
        }
        let simpleReference = true;
        let attributeGroup;
        if (typeof (object) === 'string') {
            attributeGroup = object;
        }
        else {
            simpleReference = false;
            if (typeof (object.attributeGroupReference) === 'string') {
                attributeGroup = object.attributeGroupReference;
            }
            else {
                attributeGroup = __1.CdmFolder.AttributeGroupPersistence.fromData(ctx, object.attributeGroupReference, entityName);
            }
        }
        return ctx.corpus.MakeRef(internal_1.cdmObjectType.attributeGroupRef, attributeGroup, simpleReference);
    }
}
exports.AttributeGroupReferencePersistence = AttributeGroupReferencePersistence;
//# sourceMappingURL=AttributeGroupReferencePersistence.js.map