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 __());
    };
})();
/* Generated from Java with JSweet 2.3.7 - http://www.jsweet.org */
import { ModelUtils } from '../../cmd/util/ModelUtils';
import { NodeCompat } from '../../compat/NodeCompat';
import { Operation } from '../../core/models/common/Operation';
/**
 * Constructor.
 * @param {string} method
 * @class
 * @extends Operation
 * @author eric.wittmann@gmail.com
 */
var OasOperation = /** @class */ (function (_super) {
    __extends(OasOperation, _super);
    function OasOperation(method) {
        var _this = _super.call(this, method) || this;
        if (_this.tags === undefined)
            _this.tags = null;
        if (_this.parameters === undefined)
            _this.parameters = null;
        if (_this.responses === undefined)
            _this.responses = null;
        if (_this.deprecated === undefined)
            _this.deprecated = null;
        if (_this.security === undefined)
            _this.security = null;
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.openapi.models.IOasParameterParent#getParameters()
     * @return {OasParameter[]}
     */
    OasOperation.prototype.getParameters = function () {
        return this.parameters;
    };
    /**
     * @see io.apicurio.datamodels.openapi.models.IOasParameterParent#getParametersIn(java.lang.String)
     * @param {string} in
     * @return {OasParameter[]}
     */
    OasOperation.prototype.getParametersIn = function (__in) {
        var params = ([]);
        if (ModelUtils.isDefined(this.parameters)) {
            this.parameters.forEach((function (params) {
                return function (param) {
                    if (NodeCompat.equals(param.in, __in)) {
                        /* add */ (params.push(param) > 0);
                    }
                };
            })(params));
        }
        return params;
    };
    /**
     * Gets the operation's method.
     * @return {string}
     */
    OasOperation.prototype.getMethod = function () {
        return this.getType();
    };
    /**
     * Returns a single, unique parameter identified by "in" and "name" (which are the two
     * properties that uniquely identify a parameter).  Returns null if no parameter is found.
     * @param {string} in
     * @param {string} name
     * @return {OasParameter}
     */
    OasOperation.prototype.getParameter = function (__in, name) {
        var rval = null;
        if (this.parameters != null) {
            for (var index166 = 0; index166 < this.parameters.length; index166++) {
                var parameter = this.parameters[index166];
                {
                    if (NodeCompat.equals(parameter.in, __in) && NodeCompat.equals(parameter.name, name)) {
                        rval = parameter;
                    }
                }
            }
        }
        return rval;
    };
    /**
     * Adds a parameter.
     * @param {OasParameter} parameter
     * @return {OasParameter}
     */
    OasOperation.prototype.addParameter = function (parameter) {
        if (this.parameters == null) {
            this.parameters = ([]);
        }
        /* add */ (this.parameters.push(parameter) > 0);
        return parameter;
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.ISecurityRequirementParent#addSecurityRequirement(io.apicurio.datamodels.core.models.common.SecurityRequirement)
     * @param {SecurityRequirement} securityRequirement
     * @return {SecurityRequirement}
     */
    OasOperation.prototype.addSecurityRequirement = function (securityRequirement) {
        if (this.security == null) {
            this.security = ([]);
        }
        /* add */ (this.security.push(securityRequirement) > 0);
        return securityRequirement;
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.ISecurityRequirementParent#getSecurityRequirements()
     * @return {SecurityRequirement[]}
     */
    OasOperation.prototype.getSecurityRequirements = function () {
        return this.security;
    };
    return OasOperation;
}(Operation));
export { OasOperation };
OasOperation["__class"] = "io.apicurio.datamodels.openapi.models.OasOperation";
OasOperation["__interfaces"] = ["io.apicurio.datamodels.core.models.common.ISecurityRequirementParent", "io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.openapi.models.IOasParameterParent", "io.apicurio.datamodels.core.models.common.IExternalDocumentationParent"];
//# sourceMappingURL=OasOperation.js.map