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 { AbstractCommand } from '../AbstractCommand';
import { ModelUtils } from '../util/ModelUtils';
import { LoggerCompat } from '../../compat/LoggerCompat';
/**
 * A command used to delete a security scheme.
 * @author eric.wittmann@gmail.com
 * @extends AbstractCommand
 * @class
 */
var DeleteSecuritySchemeCommand = /** @class */ (function (_super) {
    __extends(DeleteSecuritySchemeCommand, _super);
    function DeleteSecuritySchemeCommand(schemeName) {
        var _this = this;
        if (((typeof schemeName === 'string') || schemeName === null)) {
            var __args = arguments;
            _this = _super.call(this) || this;
            if (_this._schemeName === undefined)
                _this._schemeName = null;
            if (_this._oldScheme === undefined)
                _this._oldScheme = null;
            if (_this._schemeName === undefined)
                _this._schemeName = null;
            if (_this._oldScheme === undefined)
                _this._oldScheme = null;
            (function () {
                _this._schemeName = schemeName;
            })();
        }
        else if (schemeName === undefined) {
            var __args = arguments;
            _this = _super.call(this) || this;
            if (_this._schemeName === undefined)
                _this._schemeName = null;
            if (_this._oldScheme === undefined)
                _this._oldScheme = null;
            if (_this._schemeName === undefined)
                _this._schemeName = null;
            if (_this._oldScheme === undefined)
                _this._oldScheme = null;
        }
        else
            throw new Error('invalid overload');
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.cmd.ICommand#execute(io.apicurio.datamodels.core.models.Document)
     * @param {Document} document
     */
    DeleteSecuritySchemeCommand.prototype.execute = function (document) {
        LoggerCompat.info("[DeleteSecuritySchemeCommand] Executing.");
        this._oldScheme = null;
        this._oldScheme = this.doDeleteScheme(document);
    };
    /**
     * @see io.apicurio.datamodels.cmd.ICommand#undo(io.apicurio.datamodels.core.models.Document)
     * @param {Document} document
     */
    DeleteSecuritySchemeCommand.prototype.undo = function (document) {
        LoggerCompat.info("[DeleteSecuritySchemeCommand] Reverting.");
        if (ModelUtils.isDefined(this._oldScheme)) {
            this.doRestoreScheme(document, this._oldScheme);
        }
    };
    return DeleteSecuritySchemeCommand;
}(AbstractCommand));
export { DeleteSecuritySchemeCommand };
DeleteSecuritySchemeCommand["__class"] = "io.apicurio.datamodels.cmd.commands.DeleteSecuritySchemeCommand";
DeleteSecuritySchemeCommand["__interfaces"] = ["io.apicurio.datamodels.cmd.ICommand"];
//# sourceMappingURL=DeleteSecuritySchemeCommand.js.map