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 { LoggerCompat } from '../../compat/LoggerCompat';
/**
 * A command used to delete a response definition.
 * @author eric.wittmann@gmail.com
 * @extends AbstractCommand
 * @class
 */
var DeleteResponseDefinitionCommand = /** @class */ (function (_super) {
    __extends(DeleteResponseDefinitionCommand, _super);
    function DeleteResponseDefinitionCommand(definitionName) {
        var _this = this;
        if (((typeof definitionName === 'string') || definitionName === null)) {
            var __args = arguments;
            _this = _super.call(this) || this;
            if (_this._definitionName === undefined)
                _this._definitionName = null;
            if (_this._oldDefinition === undefined)
                _this._oldDefinition = null;
            if (_this._definitionName === undefined)
                _this._definitionName = null;
            if (_this._oldDefinition === undefined)
                _this._oldDefinition = null;
            (function () {
                _this._definitionName = definitionName;
            })();
        }
        else if (definitionName === undefined) {
            var __args = arguments;
            _this = _super.call(this) || this;
            if (_this._definitionName === undefined)
                _this._definitionName = null;
            if (_this._oldDefinition === undefined)
                _this._oldDefinition = null;
            if (_this._definitionName === undefined)
                _this._definitionName = null;
            if (_this._oldDefinition === undefined)
                _this._oldDefinition = 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
     */
    DeleteResponseDefinitionCommand.prototype.execute = function (document) {
        LoggerCompat.info("[DeleteDefinitionResponseCommand] Executing.");
        this._oldDefinition = this.doDeleteResponseDefinition(document);
    };
    /**
     * @see io.apicurio.datamodels.cmd.ICommand#undo(io.apicurio.datamodels.core.models.Document)
     * @param {Document} document
     */
    DeleteResponseDefinitionCommand.prototype.undo = function (document) {
        LoggerCompat.info("[DeleteDefinitionResponseCommand] Reverting.");
        if (this.isNullOrUndefined(this._oldDefinition)) {
            return;
        }
        this.doRestoreResponseDefinition(document, this._oldDefinition);
    };
    return DeleteResponseDefinitionCommand;
}(AbstractCommand));
export { DeleteResponseDefinitionCommand };
DeleteResponseDefinitionCommand["__class"] = "io.apicurio.datamodels.cmd.commands.DeleteResponseDefinitionCommand";
DeleteResponseDefinitionCommand["__interfaces"] = ["io.apicurio.datamodels.cmd.ICommand"];
//# sourceMappingURL=DeleteResponseDefinitionCommand.js.map