"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.CdmAttributeGroupReference = void 0;
const internal_1 = require("../internal");
class CdmAttributeGroupReference extends internal_1.CdmObjectReferenceBase {
    static get objectType() {
        return internal_1.cdmObjectType.attributeGroupRef;
    }
    constructor(ctx, attributeGroup, simpleReference) {
        super(ctx, attributeGroup, simpleReference);
        // let bodyCode = () =>
        {
            this.objectType = internal_1.cdmObjectType.attributeGroupRef;
        }
        // return p.measure(bodyCode);
    }
    getObjectType() {
        // let bodyCode = () =>
        {
            return internal_1.cdmObjectType.attributeGroupRef;
        }
        // return p.measure(bodyCode);
    }
    /**
     * @internal
     */
    copyRefObject(resOpt, refTo, simpleReference, host) {
        // let bodyCode = () =>
        {
            if (!host) {
                // for inline attribute group definition, the owner information is lost here when a ref object created
                // updating it here
                if (this.explicitReference && this.explicitReference.objectType === internal_1.cdmObjectType.attributeGroupDef && !this.explicitReference.owner) {
                    this.explicitReference.owner = this.owner;
                }
                return new CdmAttributeGroupReference(this.ctx, refTo, simpleReference);
            }
            else {
                return host.copyToHost(this.ctx, refTo, simpleReference);
            }
        }
        // return p.measure(bodyCode);
    }
    /**
     * @internal
     */
    visitRef(pathFrom, preChildren, postChildren) {
        // let bodyCode = () =>
        {
            return false;
        }
        // return p.measure(bodyCode);
    }
    /**
     * @deprecated
     * For internal use only.
     */
    fetchResolvedEntityReference(resOpt) {
        // let bodyCode = () =>
        {
            if (!resOpt) {
                resOpt = new internal_1.resolveOptions(this, this.ctx.corpus.defaultResolutionDirectives);
            }
            const ref = this.fetchResolvedReference(resOpt);
            if (ref) {
                return ref.fetchResolvedEntityReference(resOpt);
            }
            if (this.explicitReference) {
                return this.explicitReference.fetchResolvedEntityReference(resOpt);
            }
            return undefined;
        }
        // return p.measure(bodyCode);
    }
}
exports.CdmAttributeGroupReference = CdmAttributeGroupReference;
//# sourceMappingURL=CdmAttributeGroupReference.js.map