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 { NodeCompat } from '../../../compat/NodeCompat';
import { OasOperation } from '../../models/OasOperation';
/**
 * Constructor.
 * @param {string} method
 * @class
 * @extends OasOperation
 * @author eric.wittmann@gmail.com
 */
var Oas30Operation = /** @class */ (function (_super) {
    __extends(Oas30Operation, _super);
    function Oas30Operation(method) {
        var _this = _super.call(this, method) || this;
        if (_this.requestBody === undefined)
            _this.requestBody = null;
        _this.callbacks = ({});
        if (_this.servers === undefined)
            _this.servers = null;
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.core.models.common.Operation#createExternalDocumentation()
     * @return {ExternalDocumentation}
     */
    Oas30Operation.prototype.createExternalDocumentation = function () {
        var externalDocs = new Oas30ExternalDocumentation();
        externalDocs._ownerDocument = this.ownerDocument();
        externalDocs._parent = this;
        return externalDocs;
    };
    /**
     * @see io.apicurio.datamodels.openapi.models.OasOperation#createParameter()
     * @return {OasParameter}
     */
    Oas30Operation.prototype.createParameter = function () {
        var param = new Oas30Parameter();
        param._ownerDocument = this.ownerDocument();
        param._parent = this;
        return param;
    };
    /**
     * @see io.apicurio.datamodels.openapi.models.OasOperation#createResponses()
     * @return {OasResponses}
     */
    Oas30Operation.prototype.createResponses = function () {
        var responses = new Oas30Responses();
        responses._ownerDocument = this.ownerDocument();
        responses._parent = this;
        return responses;
    };
    /**
     * @see io.apicurio.datamodels.openapi.models.OasOperation#createSecurityRequirement()
     * @return {OasSecurityRequirement}
     */
    Oas30Operation.prototype.createSecurityRequirement = function () {
        var requirement = new Oas30SecurityRequirement();
        requirement._ownerDocument = this.ownerDocument();
        requirement._parent = this;
        return requirement;
    };
    /**
     * Creates a callback.
     * @param {string} name
     * @return {Oas30Callback}
     */
    Oas30Operation.prototype.createCallback = function (name) {
        var rval = new Oas30Callback(name);
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * Adds a callback.
     * @param {string} name
     * @param {Oas30Callback} callback
     */
    Oas30Operation.prototype.addCallback = function (name, callback) {
        /* put */ (this.callbacks[name] = callback);
    };
    /**
     * Gets a single callback by name.
     * @param {string} name
     * @return {Oas30Callback}
     */
    Oas30Operation.prototype.getCallback = function (name) {
        return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.callbacks, name);
    };
    /**
     * Removes a single callback and returns it.  This may return null or undefined if none found.
     * @param {string} name
     * @return {Oas30Callback}
     */
    Oas30Operation.prototype.removeCallback = function (name) {
        var _this = this;
        return /* remove */ (function (map) { var deleted = _this.callbacks[name]; delete _this.callbacks[name]; return deleted; })(this.callbacks);
    };
    /**
     * Gets a list of all callbacks.
     * @return {Oas30Callback[]}
     */
    Oas30Operation.prototype.getCallbacks = function () {
        var rval = ([]);
        /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(rval, /* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(this.callbacks));
        return rval;
    };
    /**
     * Creates a child RequestBody model.
     * @return {Oas30RequestBody}
     */
    Oas30Operation.prototype.createRequestBody = function () {
        var rval = new Oas30RequestBody();
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.IServerParent#createServer()
     * @return {Server}
     */
    Oas30Operation.prototype.createServer = function () {
        var rval = new Oas30Server();
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.IServerParent#addServer(io.apicurio.datamodels.core.models.common.Server)
     * @param {Server} server
     */
    Oas30Operation.prototype.addServer = function (server) {
        if (this.servers == null) {
            this.servers = ([]);
        }
        /* add */ (this.servers.push(server) > 0);
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.IServerParent#getServer(java.lang.String)
     * @param {string} url
     * @return {Server}
     */
    Oas30Operation.prototype.getServer = function (url) {
        if (this.servers != null) {
            for (var index200 = 0; index200 < this.servers.length; index200++) {
                var server = this.servers[index200];
                {
                    if (NodeCompat.equals(server.url, url)) {
                        return server;
                    }
                }
            }
        }
        return null;
    };
    /**
     * @see io.apicurio.datamodels.core.models.common.IServerParent#getServers()
     * @return {Server[]}
     */
    Oas30Operation.prototype.getServers = function () {
        return this.servers;
    };
    return Oas30Operation;
}(OasOperation));
export { Oas30Operation };
Oas30Operation["__class"] = "io.apicurio.datamodels.openapi.v3.models.Oas30Operation";
Oas30Operation["__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", "io.apicurio.datamodels.core.models.common.IServerParent"];
import { Oas30Server } from './Oas30Server';
import { Oas30SecurityRequirement } from './Oas30SecurityRequirement';
import { Oas30Responses } from './Oas30Responses';
import { Oas30Parameter } from './Oas30Parameter';
import { Oas30ExternalDocumentation } from './Oas30ExternalDocumentation';
import { Oas30Callback } from './Oas30Callback';
import { Oas30RequestBody } from './Oas30RequestBody';
//# sourceMappingURL=Oas30Operation.js.map