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 { ExtensibleNode } from '../ExtensibleNode';
/**
 * @author eric.wittmann@gmail.com
 * @class
 * @extends ExtensibleNode
 */
var Server = /** @class */ (function (_super) {
    __extends(Server, _super);
    function Server() {
        var _this = _super.call(this) || this;
        if (_this.url === undefined)
            _this.url = null;
        if (_this.description === undefined)
            _this.description = null;
        if (_this.variables === undefined)
            _this.variables = null;
        return _this;
    }
    /**
     * Adds a server variable.
     * @param {string} name
     * @param {ServerVariable} serverVariable
     */
    Server.prototype.addServerVariable = function (name, serverVariable) {
        if (this.variables == null) {
            this.variables = ({});
        }
        /* put */ (this.variables[name] = serverVariable);
    };
    /**
     * Gets a single server variable by name.
     * @param {string} name
     * @return {ServerVariable}
     */
    Server.prototype.getServerVariable = function (name) {
        if (this.variables != null) {
            return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.variables, name);
        }
        return null;
    };
    /**
     * Removes a single server variable and returns it.  This may return null or undefined if none found.
     * @param {string} name
     * @return {ServerVariable}
     */
    Server.prototype.removeServerVariable = function (name) {
        var _this = this;
        if (this.variables != null) {
            return /* remove */ (function (map) { var deleted = _this.variables[name]; delete _this.variables[name]; return deleted; })(this.variables);
        }
        return null;
    };
    /**
     * Gets a list of all server variables.
     * @return {ServerVariable[]}
     */
    Server.prototype.getServerVariables = function () {
        var rval = ([]);
        if (this.variables != null) {
            /* 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.variables));
        }
        return rval;
    };
    return Server;
}(ExtensibleNode));
export { Server };
Server["__class"] = "io.apicurio.datamodels.core.models.common.Server";
Server["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable"];
//# sourceMappingURL=Server.js.map