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 { Schema } from '../../core/models/common/Schema';
/**
 * Models an OpenAPI schema.
 * @author eric.wittmann@gmail.com
 * @class
 * @extends Schema
 */
var OasSchema = /** @class */ (function (_super) {
    __extends(OasSchema, _super);
    function OasSchema() {
        var _this = _super.call(this) || this;
        if (_this.format === undefined)
            _this.format = null;
        if (_this.title === undefined)
            _this.title = null;
        if (_this.description === undefined)
            _this.description = null;
        if (_this.default_ === undefined)
            _this.default_ = null;
        if (_this.multipleOf === undefined)
            _this.multipleOf = null;
        if (_this.maximum === undefined)
            _this.maximum = null;
        if (_this.exclusiveMaximum === undefined)
            _this.exclusiveMaximum = null;
        if (_this.minimum === undefined)
            _this.minimum = null;
        if (_this.exclusiveMinimum === undefined)
            _this.exclusiveMinimum = null;
        if (_this.maxLength === undefined)
            _this.maxLength = null;
        if (_this.minLength === undefined)
            _this.minLength = null;
        if (_this.pattern === undefined)
            _this.pattern = null;
        if (_this.maxItems === undefined)
            _this.maxItems = null;
        if (_this.minItems === undefined)
            _this.minItems = null;
        if (_this.uniqueItems === undefined)
            _this.uniqueItems = null;
        if (_this.maxProperties === undefined)
            _this.maxProperties = null;
        if (_this.minProperties === undefined)
            _this.minProperties = null;
        if (_this.required === undefined)
            _this.required = null;
        if (_this.enum_ === undefined)
            _this.enum_ = null;
        if (_this.type === undefined)
            _this.type = null;
        if (_this.items === undefined)
            _this.items = null;
        if (_this.allOf === undefined)
            _this.allOf = null;
        if (_this.properties === undefined)
            _this.properties = null;
        if (_this.additionalProperties === undefined)
            _this.additionalProperties = null;
        if (_this.readOnly === undefined)
            _this.readOnly = null;
        if (_this.xml === undefined)
            _this.xml = null;
        if (_this.externalDocs === undefined)
            _this.externalDocs = null;
        if (_this.example === undefined)
            _this.example = null;
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.core.models.common.IExternalDocumentationParent#setExternalDocumentation(io.apicurio.datamodels.core.models.common.ExternalDocumentation)
     * @param {ExternalDocumentation} externalDocs
     */
    OasSchema.prototype.setExternalDocumentation = function (externalDocs) {
        this.externalDocs = externalDocs;
    };
    /**
     * Gets a list of all property names.
     * @return {string[]}
     */
    OasSchema.prototype.getPropertyNames = function () {
        var rval = ([]);
        if (this.properties != null) {
            /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(rval, /* keySet */ Object.keys(this.properties));
        }
        return rval;
    };
    /**
     * Gets a list of all the properties.
     * @return {OasSchema[]}
     */
    OasSchema.prototype.getProperties = function () {
        var rval = ([]);
        if (this.properties != 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.properties));
        }
        return rval;
    };
    /**
     * Add a property.
     * @param {string} propertyName
     * @param {OasSchema} schema
     * @return {OasSchema}
     */
    OasSchema.prototype.addProperty = function (propertyName, schema) {
        if (this.properties == null) {
            this.properties = ({});
        }
        /* put */ (this.properties[propertyName] = schema);
        return schema;
    };
    /**
     * Removes a property by name.
     * @param {string} propertyName
     * @return {OasSchema}
     */
    OasSchema.prototype.removeProperty = function (propertyName) {
        var _this = this;
        if (this.properties != null) {
            return /* remove */ (function (map) { var deleted = _this.properties[propertyName]; delete _this.properties[propertyName]; return deleted; })(this.properties);
        }
        return null;
    };
    /**
     * Gets a single property.
     * @param {string} propertyName
     * @return {OasSchema}
     */
    OasSchema.prototype.getProperty = function (propertyName) {
        if (this.properties != null) {
            return /* get */ (function (m, k) { return m[k] === undefined ? null : m[k]; })(this.properties, propertyName);
        }
        return null;
    };
    /**
     * Returns true if there is a single items schema.
     * @return {boolean}
     */
    OasSchema.prototype.hasItemsSchema = function () {
        return NodeCompat.isNode(this.items);
    };
    /**
     * Returns true if there is a list of items schemas.  Even if there is only one schema in the list.
     * @return {boolean}
     */
    OasSchema.prototype.hasItemsSchemas = function () {
        return NodeCompat.isList(this.items);
    };
    /**
     * Returns true if there is an additional properties schema.
     * @return {boolean}
     */
    OasSchema.prototype.hasAdditionalPropertiesSchema = function () {
        return NodeCompat.isNode(this.additionalProperties);
    };
    /**
     * Returns true if there is an "additionalProperties" property that is a boolean value and not a schema.
     * @return {boolean}
     */
    OasSchema.prototype.hasAdditionalPropertiesBoolean = function () {
        return this.additionalProperties != null && !NodeCompat.isNode(this.additionalProperties);
    };
    /**
     * Adds an AllOf schema.
     * @param {OasSchema} schema
     */
    OasSchema.prototype.addAllOfSchema = function (schema) {
        if (this.allOf == null) {
            this.allOf = ([]);
        }
        /* add */ (this.allOf.push(schema) > 0);
    };
    /**
     * Removes a allOf schema.
     * @param {OasSchema} schema
     */
    OasSchema.prototype.removeAllOfSchema = function (schema) {
        if (this.allOf != null) {
            /* remove */ (function (a) { var index = a.indexOf(schema); if (index >= 0) {
                a.splice(index, 1);
                return true;
            }
            else {
                return false;
            } })(this.allOf);
        }
    };
    return OasSchema;
}(Schema));
export { OasSchema };
OasSchema["__class"] = "io.apicurio.datamodels.openapi.models.OasSchema";
OasSchema["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.core.models.IReferenceNode", "io.apicurio.datamodels.core.models.common.IExternalDocumentationParent"];
//# sourceMappingURL=OasSchema.js.map