"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.CdmTraitGroupDefinition = void 0;
const internal_1 = require("../internal");
/**
 * The CDM definition of a Trait Group object, representing a collection (grouping) of one or more traits.
 */
class CdmTraitGroupDefinition extends internal_1.CdmObjectDefinitionBase {
    constructor(ctx, traitGroupName) {
        super(ctx);
        this.TAG = CdmTraitGroupDefinition.name;
        // let bodyCode = () =>
        {
            this.objectType = internal_1.cdmObjectType.traitGroupDef;
            this.traitGroupName = traitGroupName;
        }
        // return p.measure(bodyCode);
    }
    getObjectType() {
        // let bodyCode = () =>
        {
            return internal_1.cdmObjectType.traitGroupDef;
        }
        // return p.measure(bodyCode);
    }
    copy(resOpt, host) {
        // let bodyCode = () =>
        {
            if (!resOpt) {
                resOpt = new internal_1.resolveOptions(this, this.ctx.corpus.defaultResolutionDirectives);
            }
            let copy;
            if (!host) {
                copy = new CdmTraitGroupDefinition(this.ctx, this.traitGroupName);
            }
            else {
                copy = host;
                copy.traitGroupName = this.traitGroupName;
            }
            this.copyDef(resOpt, copy);
            return copy;
        }
        // return p.measure(bodyCode);
    }
    validate() {
        // let bodyCode = () =>
        {
            if (!this.traitGroupName) {
                let missingFields = ['traitGroupName'];
                internal_1.Logger.error(this.ctx, this.TAG, this.validate.name, this.atCorpusPath, internal_1.cdmLogCode.ErrValdnIntegrityCheckFailure, missingFields.map((s) => `'${s}'`).join(', '), this.atCorpusPath);
                return false;
            }
            return true;
        }
        // return p.measure(bodyCode);
    }
    getName() {
        // let bodyCode = () =>
        {
            return this.traitGroupName;
        }
        // return p.measure(bodyCode);
    }
    isDerivedFrom(base, resOpt) {
        // let bodyCode = () =>
        {
            return false;
        }
        // return p.measure(bodyCode);
    }
    visit(pathFrom, preChildren, postChildren) {
        // let bodyCode = () =>
        {
            const path = this.fetchDeclaredPath(pathFrom);
            if (preChildren && preChildren(this, path)) {
                return false;
            }
            if (this.visitDef(path, preChildren, postChildren)) {
                return true;
            }
            if (postChildren && postChildren(this, path)) {
                return true;
            }
            return false;
        }
        // return p.measure(bodyCode);
    }
    /**
     * @internal
     */
    constructResolvedTraits(rtsb, resOpt) {
        this.constructResolvedTraitsDef(null, rtsb, resOpt);
    }
    /**
     * @internal
     */
    constructResolvedAttributes(resOpt, under) {
        // let bodyCode = () =>
        {
            return undefined;
        }
        // return p.measure(bodyCode);
    }
}
exports.CdmTraitGroupDefinition = CdmTraitGroupDefinition;
//# sourceMappingURL=CdmTraitGroupDefinition.js.map