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 { ModelUtils } from '../util/ModelUtils';
import { DeleteSchemaDefinitionCommand } from './DeleteSchemaDefinitionCommand';
/**
 * @author eric.wittmann@gmail.com
 * @extends DeleteSchemaDefinitionCommand
 * @class
 */
var DeleteSchemaDefinitionCommand_30 = /** @class */ (function (_super) {
    __extends(DeleteSchemaDefinitionCommand_30, _super);
    function DeleteSchemaDefinitionCommand_30(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_30.prototype.doDeleteSchemaDefinition = function (document) {
        var doc30 = document;
        if (ModelUtils.isDefined(doc30.components)) {
            var oldDef = doc30.components.removeSchemaDefinition(this._definitionName);
            return Library.writeNode(oldDef);
        }
        return null;
    };
    /**
     * @see io.apicurio.datamodels.cmd.commands.DeleteSchemaDefinitionCommand#doRestoreSchemaDefinition(io.apicurio.datamodels.core.models.Document, java.lang.Object)
     * @param {Document} document
     * @param {*} oldDefinition
     */
    DeleteSchemaDefinitionCommand_30.prototype.doRestoreSchemaDefinition = function (document, oldDefinition) {
        var doc30 = document;
        if (ModelUtils.isDefined(doc30.components)) {
            var schemaDef = doc30.components.createSchemaDefinition(this._definitionName);
            Library.readNode(oldDefinition, schemaDef);
            doc30.components.addSchemaDefinition(this._definitionName, schemaDef);
        }
    };
    return DeleteSchemaDefinitionCommand_30;
}(DeleteSchemaDefinitionCommand));
export { DeleteSchemaDefinitionCommand_30 };
DeleteSchemaDefinitionCommand_30["__class"] = "io.apicurio.datamodels.cmd.commands.DeleteSchemaDefinitionCommand_30";
DeleteSchemaDefinitionCommand_30["__interfaces"] = ["io.apicurio.datamodels.cmd.ICommand"];
//# sourceMappingURL=DeleteSchemaDefinitionCommand_30.js.map