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 { DocumentType } from '../../core/models/DocumentType';
import { SimplifiedType } from './SimplifiedType';
/**
 * @author eric.wittmann@gmail.com
 * @class
 * @extends SimplifiedType
 */
var SimplifiedParameterType = /** @class */ (function (_super) {
    __extends(SimplifiedParameterType, _super);
    function SimplifiedParameterType() {
        var _this = _super.call(this) || this;
        if (_this.required === undefined)
            _this.required = null;
        return _this;
    }
    SimplifiedParameterType.fromParameter = function (param) {
        var rval = new SimplifiedParameterType();
        var st;
        if (param.ownerDocument().getDocumentType() === DocumentType.openapi2) {
            var param20 = param;
            if (NodeCompat.equals(param20.in, "body")) {
                st = SimplifiedType.fromSchema(param20.schema);
            }
            else {
                st = SimplifiedType.fromParameter(param);
            }
            rval.required = param20.required;
        }
        else {
            var param30 = param;
            st = SimplifiedType.fromSchema(param30.schema);
            rval.required = param30.required;
        }
        rval.type = st.type;
        rval.enum_ = st.enum_;
        rval.of = st.of;
        rval.as = st.as;
        return rval;
    };
    return SimplifiedParameterType;
}(SimplifiedType));
export { SimplifiedParameterType };
SimplifiedParameterType["__class"] = "io.apicurio.datamodels.cmd.models.SimplifiedParameterType";
//# sourceMappingURL=SimplifiedParameterType.js.map