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 { Library } from '../../Library';
import { DeleteSecuritySchemeCommand } from './DeleteSecuritySchemeCommand';
/**
 * @author eric.wittmann@gmail.com
 * @extends DeleteSecuritySchemeCommand
 * @class
 */
var DeleteSecuritySchemeCommand_20 = /** @class */ (function (_super) {
    __extends(DeleteSecuritySchemeCommand_20, _super);
    function DeleteSecuritySchemeCommand_20(schemeName) {
        var _this = this;
        if (((typeof schemeName === 'string') || schemeName === null)) {
            var __args = arguments;
            _this = _super.call(this, schemeName) || this;
        }
        else if (schemeName === undefined) {
            var __args = arguments;
            _this = _super.call(this) || this;
        }
        else
            throw new Error('invalid overload');
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.cmd.commands.DeleteSecuritySchemeCommand#doDeleteScheme(io.apicurio.datamodels.core.models.Document)
     * @param {Document} document
     * @return {*}
     */
    DeleteSecuritySchemeCommand_20.prototype.doDeleteScheme = function (document) {
        var doc20 = document;
        var definitions = doc20.securityDefinitions;
        if (this.isNullOrUndefined(definitions)) {
            return null;
        }
        return Library.writeNode(definitions.removeSecurityScheme(this._schemeName));
    };
    /**
     * @see io.apicurio.datamodels.cmd.commands.DeleteSecuritySchemeCommand#doRestoreScheme(io.apicurio.datamodels.core.models.Document, java.lang.Object)
     * @param {Document} document
     * @param {*} oldScheme
     */
    DeleteSecuritySchemeCommand_20.prototype.doRestoreScheme = function (document, oldScheme) {
        var doc20 = document;
        var definitions = doc20.securityDefinitions;
        if (this.isNullOrUndefined(definitions) || this.isNullOrUndefined(oldScheme)) {
            return;
        }
        var scheme = definitions.createSecurityScheme(this._schemeName);
        Library.readNode(oldScheme, scheme);
        definitions.addSecurityScheme(this._schemeName, scheme);
    };
    return DeleteSecuritySchemeCommand_20;
}(DeleteSecuritySchemeCommand));
export { DeleteSecuritySchemeCommand_20 };
DeleteSecuritySchemeCommand_20["__class"] = "io.apicurio.datamodels.cmd.commands.DeleteSecuritySchemeCommand_20";
DeleteSecuritySchemeCommand_20["__interfaces"] = ["io.apicurio.datamodels.cmd.ICommand"];
//# sourceMappingURL=DeleteSecuritySchemeCommand_20.js.map