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 { ModelUtils } from '../util/ModelUtils';
import { RenameResponseDefinitionCommand } from './RenameResponseDefinitionCommand';
/**
 * @author eric.wittmann@gmail.com
 * @extends RenameResponseDefinitionCommand
 * @class
 */
var RenameResponseDefinitionCommand_20 = /** @class */ (function (_super) {
    __extends(RenameResponseDefinitionCommand_20, _super);
    function RenameResponseDefinitionCommand_20(oldName, newName) {
        var _this = this;
        if (((typeof oldName === 'string') || oldName === null) && ((typeof newName === 'string') || newName === null)) {
            var __args = arguments;
            _this = _super.call(this, oldName, newName) || this;
        }
        else if (oldName === undefined && newName === undefined) {
            var __args = arguments;
            _this = _super.call(this) || this;
        }
        else
            throw new Error('invalid overload');
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.cmd.commands.RenameResponseDefinitionCommand#_nameToReference(java.lang.String)
     * @param {string} name
     * @return {string}
     */
    RenameResponseDefinitionCommand_20.prototype._nameToReference = function (name) {
        return "#/responses/" + name;
    };
    /**
     * @see io.apicurio.datamodels.cmd.commands.RenameResponseDefinitionCommand#_renameResponseDefinition(io.apicurio.datamodels.openapi.models.OasDocument, java.lang.String, java.lang.String)
     * @param {OasDocument} document
     * @param {string} fromName
     * @param {string} toName
     * @return {boolean}
     */
    RenameResponseDefinitionCommand_20.prototype._renameResponseDefinition = function (document, fromName, toName) {
        var doc20 = document;
        if (this.isNullOrUndefined(doc20.responses)) {
            return false;
        }
        if (ModelUtils.isDefined(doc20.responses.getResponse(toName))) {
            return false;
        }
        var responseDef = doc20.responses.removeResponse(fromName);
        responseDef.rename(toName);
        doc20.responses.addResponse(toName, responseDef);
        return true;
    };
    return RenameResponseDefinitionCommand_20;
}(RenameResponseDefinitionCommand));
export { RenameResponseDefinitionCommand_20 };
RenameResponseDefinitionCommand_20["__class"] = "io.apicurio.datamodels.cmd.commands.RenameResponseDefinitionCommand_20";
RenameResponseDefinitionCommand_20["__interfaces"] = ["io.apicurio.datamodels.cmd.ICommand"];
//# sourceMappingURL=RenameResponseDefinitionCommand_20.js.map