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 { OasHeader } from '../../models/OasHeader';
/**
 * Constructor.
 * @param {string} name
 * @class
 * @extends OasHeader
 * @author eric.wittmann@gmail.com
 */
var Oas30Header = /** @class */ (function (_super) {
    __extends(Oas30Header, _super);
    function Oas30Header(name) {
        var _this = _super.call(this, name) || this;
        if (_this.$ref === undefined)
            _this.$ref = null;
        if (_this.required === undefined)
            _this.required = null;
        if (_this.deprecated === undefined)
            _this.deprecated = null;
        if (_this.allowEmptyValue === undefined)
            _this.allowEmptyValue = null;
        if (_this.style === undefined)
            _this.style = null;
        if (_this.explode === undefined)
            _this.explode = null;
        if (_this.allowReserved === undefined)
            _this.allowReserved = null;
        if (_this.schema === undefined)
            _this.schema = null;
        if (_this.example === undefined)
            _this.example = null;
        _this.examples = ({});
        _this.content = ({});
        return _this;
    }
    /**
     *
     * @return {string}
     */
    Oas30Header.prototype.getReference = function () {
        return this.$ref;
    };
    /**
     *
     * @param {string} reference
     */
    Oas30Header.prototype.setReference = function (reference) {
        this.$ref = reference;
    };
    /**
     * Creates a child items model.
     * @return {Oas30Schema}
     */
    Oas30Header.prototype.createSchema = function () {
        var rval = new Oas30Schema();
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * Creates a child Example model.
     * @param {string} name
     * @return {Oas30Example}
     */
    Oas30Header.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
     */
    Oas30Header.prototype.addExample = function (example) {
        /* put */ (this.examples[example.getName()] = example);
    };
    /**
     * Removes an Example and returns it.
     * @param {string} name
     * @return {Oas30Example}
     */
    Oas30Header.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}
     */
    Oas30Header.prototype.getExample = function (name) {
        return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.examples, name);
    };
    /**
     * Gets all examples.
     * @return {Oas30Example[]}
     */
    Oas30Header.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;
    };
    /**
     * Creates a media type.
     * @param {string} name
     * @return {Oas30MediaType}
     */
    Oas30Header.prototype.createMediaType = function (name) {
        var rval = new Oas30MediaType(name);
        rval._ownerDocument = this.ownerDocument();
        rval._parent = this;
        return rval;
    };
    /**
     * Adds a media type.
     * @param {string} name
     * @param {Oas30MediaType} mediaType
     */
    Oas30Header.prototype.addMediaType = function (name, mediaType) {
        /* put */ (this.content[name] = mediaType);
    };
    /**
     * Gets a single media type by name.
     * @param {string} name
     * @return {Oas30MediaType}
     */
    Oas30Header.prototype.getMediaType = function (name) {
        return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.content, name);
    };
    /**
     * Removes a single media type and returns it.  This may return null or undefined if none found.
     * @param {string} name
     * @return {Oas30MediaType}
     */
    Oas30Header.prototype.removeMediaType = function (name) {
        var _this = this;
        return /* remove */ (function (map) { var deleted = _this.content[name]; delete _this.content[name]; return deleted; })(this.content);
    };
    /**
     * Gets a list of all media types.
     * @return {Oas30MediaType[]}
     */
    Oas30Header.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 Oas30Header;
}(OasHeader));
export { Oas30Header };
Oas30Header["__class"] = "io.apicurio.datamodels.openapi.v3.models.Oas30Header";
Oas30Header["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.core.models.IReferenceNode", "io.apicurio.datamodels.core.models.common.INamed"];
import { Oas30MediaType } from './Oas30MediaType';
import { Oas30Example } from './Oas30Example';
import { Oas30Schema } from './Oas30Schema';
//# sourceMappingURL=Oas30Header.js.map