var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { Node } from '../../core/models/Node';
import { Operation } from '../../core/models/common/Operation';
/**
 * Constructor.
 * @param {Node} parent
 * @param {string} opType
 * @class
 * @extends Operation
 * @author Jakub Senko <jsenko@redhat.com>
 */
var AaiOperationBase = /** @class */ (function (_super) {
    __extends(AaiOperationBase, _super);
    function AaiOperationBase(parent, opType) {
        var _this = this;
        if (((parent != null && parent instanceof Node) || parent === null) && ((typeof opType === 'string') || opType === null)) {
            var __args = arguments;
            _this = _super.call(this, opType) || this;
            if (_this.$ref === undefined)
                _this.$ref = null;
            if (_this.tags === undefined)
                _this.tags = null;
            if (_this.bindings === undefined)
                _this.bindings = null;
            if (_this.$ref === undefined)
                _this.$ref = null;
            if (_this.tags === undefined)
                _this.tags = null;
            if (_this.bindings === undefined)
                _this.bindings = null;
            (function () {
                if (parent != null) {
                    _this._parent = parent;
                    _this._ownerDocument = parent.ownerDocument();
                }
            })();
        }
        else if (((typeof parent === 'string') || parent === null) && opType === undefined) {
            var __args = arguments;
            var opType_1 = __args[0];
            _this = _super.call(this, opType_1) || this;
            if (_this.$ref === undefined)
                _this.$ref = null;
            if (_this.tags === undefined)
                _this.tags = null;
            if (_this.bindings === undefined)
                _this.bindings = null;
            if (_this.$ref === undefined)
                _this.$ref = null;
            if (_this.tags === undefined)
                _this.tags = null;
            if (_this.bindings === undefined)
                _this.bindings = null;
        }
        else if (((parent != null && parent instanceof Node) || parent === null) && opType === undefined) {
            var __args = arguments;
            {
                var __args_1 = arguments;
                var opType_2 = null;
                _this = _super.call(this, opType_2) || this;
                if (_this.$ref === undefined)
                    _this.$ref = null;
                if (_this.tags === undefined)
                    _this.tags = null;
                if (_this.bindings === undefined)
                    _this.bindings = null;
                if (_this.$ref === undefined)
                    _this.$ref = null;
                if (_this.tags === undefined)
                    _this.tags = null;
                if (_this.bindings === undefined)
                    _this.bindings = null;
                (function () {
                    if (parent != null) {
                        _this._parent = parent;
                        _this._ownerDocument = parent.ownerDocument();
                    }
                })();
            }
        }
        else
            throw new Error('invalid overload');
        return _this;
    }
    /**
     *
     * @return {string}
     */
    AaiOperationBase.prototype.getReference = function () {
        return this.$ref;
    };
    /**
     *
     * @param {string} reference
     */
    AaiOperationBase.prototype.setReference = function (reference) {
        this.$ref = reference;
    };
    AaiOperationBase.prototype.addTag$io_apicurio_datamodels_asyncapi_models_AaiTag = function (tag) {
        if (this.tags == null)
            this.tags = ([]);
        /* add */ (this.tags.push(tag) > 0);
    };
    AaiOperationBase.prototype.addTag$java_lang_String$java_lang_String = function (name, description) {
        var tag = this.createTag();
        tag.name = name;
        tag.description = description;
        if (this.tags == null) {
            this.tags = ([]);
        }
        /* add */ (this.tags.push(tag) > 0);
        return tag;
    };
    /**
     * Adds a tag.
     *
     * @param {string} name
     * @param {string} description
     * @return {AaiTag}
     */
    AaiOperationBase.prototype.addTag = function (name, description) {
        if (((typeof name === 'string') || name === null) && ((typeof description === 'string') || description === null)) {
            return this.addTag$java_lang_String$java_lang_String(name, description);
        }
        else if (((name != null && name instanceof AaiTag) || name === null) && description === undefined) {
            return this.addTag$io_apicurio_datamodels_asyncapi_models_AaiTag(name);
        }
        else
            throw new Error('invalid overload');
    };
    return AaiOperationBase;
}(Operation));
export { AaiOperationBase };
AaiOperationBase["__class"] = "io.apicurio.datamodels.asyncapi.models.AaiOperationBase";
AaiOperationBase["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.core.models.IReferenceNode", "io.apicurio.datamodels.core.models.common.IExternalDocumentationParent"];
import { AaiTag } from './AaiTag';
//# sourceMappingURL=AaiOperationBase.js.map