"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.ResolvedEntityReference = void 0;
const internal_1 = require("../internal");
/**
     * @internal
     */
class ResolvedEntityReference {
    constructor() {
        // let bodyCode = () =>
        {
            this.referencing = new internal_1.ResolvedEntityReferenceSide();
            this.referenced = [];
        }
        // return p.measure(bodyCode);
    }
    copy() {
        // let bodyCode = () =>
        {
            const result = new ResolvedEntityReference();
            result.referencing.entity = this.referencing.entity;
            result.referencing.rasb = this.referencing.rasb;
            this.referenced.forEach((rers) => {
                result.referenced.push(new internal_1.ResolvedEntityReferenceSide(rers.entity, rers.rasb));
            });
            return result;
        }
        // return p.measure(bodyCode);
    }
    spew(resOpt, to, indent, nameSort) {
        // let bodyCode = () =>
        {
            this.referencing.spew(resOpt, to, `${indent}(referencing)`, nameSort);
            let list = this.referenced;
            if (nameSort) {
                list = list.sort((l, r) => l.entity.getName()
                    .localeCompare(r.entity.getName()));
            }
            for (let i = 0; i < this.referenced.length; i++) {
                list[i].spew(resOpt, to, `${indent}(referenced[${i}])`, nameSort);
            }
        }
        // return p.measure(bodyCode);
    }
}
exports.ResolvedEntityReference = ResolvedEntityReference;
//# sourceMappingURL=ResolvedEntityReference.js.map