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 { OasParameter } from '../../models/OasParameter';
/**
 * Constructor.
 * @param {string} named
 * @class
 * @extends OasParameter
 * @author eric.wittmann@gmail.com
 */
var Oas30Parameter = /** @class */ (function (_super) {
    __extends(Oas30Parameter, _super);
    function Oas30Parameter(named) {
        var _this = this;
        if (((typeof named === 'string') || named === null)) {
            var __args = arguments;
            _this = _super.call(this, named) || this;
            if (_this.deprecated === undefined)
                _this.deprecated = null;
            if (_this.style === undefined)
                _this.style = null;
            if (_this.explode === undefined)
                _this.explode = null;
            if (_this.allowReserved === undefined)
                _this.allowReserved = null;
            if (_this.example === undefined)
                _this.example = null;
            _this.examples = ({});
            _this.content = ({});
            if (_this.deprecated === undefined)
                _this.deprecated = null;
            if (_this.style === undefined)
                _this.style = null;
            if (_this.explode === undefined)
                _this.explode = null;
            if (_this.allowReserved === undefined)
                _this.allowReserved = null;
            if (_this.example === undefined)
                _this.example = null;
        }
        else if (named === undefined) {
            var __args = arguments;
            _this = _super.call(this) || this;
            if (_this.deprecated === undefined)
                _this.deprecated = null;
            if (_this.style === undefined)
                _this.style = null;
            if (_this.explode === undefined)
                _this.explode = null;
            if (_this.allowReserved === undefined)
                _this.allowReserved = null;
            if (_this.example === undefined)
                _this.example = null;
            _this.examples = ({});
            _this.content = ({});
            if (_this.deprecated === undefined)
                _this.deprecated = null;
            if (_this.style === undefined)
                _this.style = null;
            if (_this.explode === undefined)
                _this.explode = null;
            if (_this.allowReserved === undefined)
                _this.allowReserved = null;
            if (_this.example === undefined)
                _this.example = null;
        }
        else
            throw new Error('invalid overload');
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.core.models.common.Parameter#createSchema()
     * @return {Schema}
     */
    Oas30Parameter.prototype.createSchema = function () {
        var schema = new Oas30Schema();
        schema._ownerDocument = this.ownerDocument();
        schema._parent = this;
        return schema;
    };
    /**
     * Creates a child Example model.
     * @param {string} name
     * @return {Oas30Example}
     */
    Oas30Parameter.prototype.createExample = function (name) {
        var rval = new Oas30Example(name);
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * Adds the Example to the map of examples.
     * @param {Oas30Example} example
     */
    Oas30Parameter.prototype.addExample = function (example) {
        /* put */ (this.examples[example.getName()] = example);
    };
    /**
     * Removes an Example and returns it.
     * @param {string} name
     * @return {Oas30Example}
     */
    Oas30Parameter.prototype.removeExample = function (name) {
        var _this = this;
        return /* remove */ (function (map) { var deleted = _this.examples[name]; delete _this.examples[name]; return deleted; })(this.examples);
    };
    /**
     * Gets a single example by name.
     * @param {string} name
     * @return {Oas30Example}
     */
    Oas30Parameter.prototype.getExample = function (name) {
        return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.examples, name);
    };
    /**
     * Gets all examples.
     * @return {Oas30Example[]}
     */
    Oas30Parameter.prototype.getExamples = 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.examples));
        return rval;
    };
    /**
     * @see io.apicurio.datamodels.openapi.v3.models.IOas30MediaTypeParent#createMediaType(java.lang.String)
     * @param {string} name
     * @return {Oas30MediaType}
     */
    Oas30Parameter.prototype.createMediaType = function (name) {
        var rval = new Oas30MediaType(name);
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * @see io.apicurio.datamodels.openapi.v3.models.IOas30MediaTypeParent#addMediaType(java.lang.String, io.apicurio.datamodels.openapi.v3.models.Oas30MediaType)
     * @param {string} name
     * @param {Oas30MediaType} mediaType
     */
    Oas30Parameter.prototype.addMediaType = function (name, mediaType) {
        /* put */ (this.content[name] = mediaType);
    };
    /**
     * @see io.apicurio.datamodels.openapi.v3.models.IOas30MediaTypeParent#getMediaType(java.lang.String)
     * @param {string} name
     * @return {Oas30MediaType}
     */
    Oas30Parameter.prototype.getMediaType = function (name) {
        return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.content, name);
    };
    /**
     * @see io.apicurio.datamodels.openapi.v3.models.IOas30MediaTypeParent#removeMediaType(java.lang.String)
     * @param {string} name
     * @return {Oas30MediaType}
     */
    Oas30Parameter.prototype.removeMediaType = function (name) {
        var _this = this;
        return /* remove */ (function (map) { var deleted = _this.content[name]; delete _this.content[name]; return deleted; })(this.content);
    };
    /**
     * @see io.apicurio.datamodels.openapi.v3.models.IOas30MediaTypeParent#getMediaTypes()
     * @return {Oas30MediaType[]}
     */
    Oas30Parameter.prototype.getMediaTypes = 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.content));
        return rval;
    };
    return Oas30Parameter;
}(OasParameter));
export { Oas30Parameter };
Oas30Parameter["__class"] = "io.apicurio.datamodels.openapi.v3.models.Oas30Parameter";
Oas30Parameter["__interfaces"] = ["io.apicurio.datamodels.core.models.common.IExampleParent", "io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.core.models.IReferenceNode", "io.apicurio.datamodels.openapi.v3.models.IOas30MediaTypeParent", "io.apicurio.datamodels.core.models.common.INamed"];
import { Oas30Schema } from './Oas30Schema';
import { Oas30MediaType } from './Oas30MediaType';
import { Oas30Example } from './Oas30Example';
//# sourceMappingURL=Oas30Parameter.js.map