"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.ResolvedEntity = void 0;
/**
     * @internal
     */
class ResolvedEntity {
    constructor(resOpt, entDef) {
        this.entity = entDef;
        this.resolvedName = this.entity.getName();
        this.resolvedTraits = this.entity.fetchResolvedTraits(resOpt);
        this.resolvedAttributes = this.entity.fetchResolvedAttributes(resOpt);
        this.resolvedEntityReferences = this.entity.fetchResolvedEntityReference(resOpt);
    }
    get sourceName() {
        return this.entity.sourceName;
    }
    get description() {
        return this.entity.description;
    }
    get displayName() {
        return this.entity.displayName;
    }
    get version() {
        return this.entity.version;
    }
    get cdmSchemas() {
        return this.entity.cdmSchemas;
    }
    spewProperties(to, indent) {
        if (this.displayName) {
            to.spewLine(`${indent}displayName: ${this.displayName}`);
        }
        if (this.description) {
            to.spewLine(`${indent}description: ${this.description}`);
        }
        if (this.version) {
            to.spewLine(`${indent}version: ${this.version}`);
        }
        if (this.sourceName) {
            to.spewLine(`${indent}sourceName: ${this.sourceName}`);
        }
    }
    spew(resOpt, to, indent, nameSort) {
        to.spewLine(`${indent}=====ENTITY=====`);
        to.spewLine(`${indent}${this.resolvedName}`);
        to.spewLine(`${indent}================`);
        to.spewLine(`${indent}properties:`);
        this.spewProperties(to, `${indent} `);
        to.spewLine(`${indent}traits:`);
        this.resolvedTraits.spew(resOpt, to, `${indent} `, nameSort);
        to.spewLine('attributes:');
        if (this.resolvedAttributes !== undefined) {
            this.resolvedAttributes.spew(resOpt, to, `${indent} `, nameSort);
        }
        to.spewLine('relationships:');
        this.resolvedEntityReferences.spew(resOpt, to, `${indent} `, nameSort);
    }
}
exports.ResolvedEntity = ResolvedEntity;
//# sourceMappingURL=ResolvedEntity.js.map