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 { DeleteSchemaDefinitionCommand } from './DeleteSchemaDefinitionCommand';
/**
 * @author eric.wittmann@gmail.com
 * @extends DeleteSchemaDefinitionCommand
 * @class
 */
var DeleteSchemaDefinitionCommand_20 = /** @class */ (function (_super) {
    __extends(DeleteSchemaDefinitionCommand_20, _super);
    function DeleteSchemaDefinitionCommand_20(definitionName) {
        var _this = this;
        if (((typeof definitionName === 'string') || definitionName === null)) {
            var __args = arguments;
            _this = _super.call(this, definitionName) || this;
        }
        else if (definitionName === undefined) {
            var __args = arguments;
            _this = _super.call(this) || this;
        }
        else
            throw new Error('invalid overload');
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.cmd.commands.DeleteSchemaDefinitionCommand#doDeleteSchemaDefinition(io.apicurio.datamodels.core.models.Document)
     * @param {Document} document
     * @return {*}
     */
    DeleteSchemaDefinitionCommand_20.prototype.doDeleteSchemaDefinition = function (document) {
        var doc20 = document;
        var definitions = doc20.definitions;
        if (this.isNullOrUndefined(definitions)) {
            return null;
        }
        var schemaDef = definitions.removeDefinition(this._definitionName);
        return Library.writeNode(schemaDef);
    };
    /**
     * @see io.apicurio.datamodels.cmd.commands.DeleteSchemaDefinitionCommand#doRestoreSchemaDefinition(io.apicurio.datamodels.core.models.Document, java.lang.Object)
     * @param {Document} document
     * @param {*} oldDefinition
     */
    DeleteSchemaDefinitionCommand_20.prototype.doRestoreSchemaDefinition = function (document, oldDefinition) {
        var doc20 = document;
        var definitions = doc20.definitions;
        if (this.isNullOrUndefined(definitions)) {
            return;
        }
        var definition = doc20.definitions.createSchemaDefinition(this._definitionName);
        Library.readNode(oldDefinition, definition);
        definitions.addDefinition(this._definitionName, definition);
    };
    return DeleteSchemaDefinitionCommand_20;
}(DeleteSchemaDefinitionCommand));
export { DeleteSchemaDefinitionCommand_20 };
DeleteSchemaDefinitionCommand_20["__class"] = "io.apicurio.datamodels.cmd.commands.DeleteSchemaDefinitionCommand_20";
DeleteSchemaDefinitionCommand_20["__interfaces"] = ["io.apicurio.datamodels.cmd.ICommand"];
//# sourceMappingURL=DeleteSchemaDefinitionCommand_20.js.map