"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.CdmDefinitionCollection = void 0;
const util_1 = require("util");
const internal_1 = require("../internal");
class CdmDefinitionCollection extends internal_1.CdmCollection {
    get owner() {
        return super.owner;
    }
    set owner(value) {
        super.owner = value;
    }
    constructor(ctx, owner) {
        super(ctx, owner, internal_1.cdmObjectType.entityDef);
    }
    /**
     * Adds to the collection either an existing element, a newly created element, or all the elements of a list.
     * @param parameter Either the name of a CdmEntityDefinition
     * or a type of a new element to be created,
     * or a cdmObjectDefinition to be added to the collection
     * or a list of cdmObjectDefinitions to be added to the collection.
     * @param nameorSimpleRef Only used if the first parameter is the type of the object to be created.
     * It is the name of the object to be created in this case.
     * Should never be boolean.
     */
    push(parameter, nameorSimpleRef) {
        if (util_1.isNumber(parameter)) {
            const createdObject = this.ctx.corpus.MakeObject(parameter, nameorSimpleRef);
            return super.push(createdObject);
        }
        else if (util_1.isString(parameter)) {
            return super.push(parameter, util_1.isBoolean(nameorSimpleRef) ? nameorSimpleRef : false);
        }
        else {
            return super.push(parameter);
        }
    }
}
exports.CdmDefinitionCollection = CdmDefinitionCollection;
//# sourceMappingURL=CdmDefinitionCollection.js.map