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 { ExternalDocumentation } from './common/ExternalDocumentation';
import { ExtensibleNode } from './ExtensibleNode';
/**
 * Constructor.
 * @class
 * @extends ExtensibleNode
 * @author eric.wittmann@gmail.com
 */
var Document = /** @class */ (function (_super) {
    __extends(Document, _super);
    function Document() {
        var _this = _super.call(this) || this;
        if (_this.info === undefined)
            _this.info = null;
        if (_this.tags === undefined)
            _this.tags = null;
        if (_this.externalDocs === undefined)
            _this.externalDocs = null;
        _this._ownerDocument = _this;
        _this._parent = null;
        return _this;
    }
    /**
     * @see io.apicurio.datamodels.core.models.Node#accept(io.apicurio.datamodels.core.visitors.IVisitor)
     * @param {*} visitor
     */
    Document.prototype.accept = function (visitor) {
        visitor.visitDocument(this);
    };
    /**
     * Adds a tag.
     * @param {string} name
     * @param {string} description
     * @return {Tag}
     */
    Document.prototype.addTag = function (name, description) {
        var tag = this.createTag();
        tag.name = name;
        tag.description = description;
        if (this.tags == null) {
            this.tags = ([]);
        }
        /* add */ (this.tags.push(tag) > 0);
        return tag;
    };
    Document.prototype.setExternalDocumentation$io_apicurio_datamodels_core_models_common_ExternalDocumentation = function (externalDocs) {
        this.externalDocs = externalDocs;
    };
    Document.prototype.setExternalDocumentation$java_lang_String$java_lang_String = function (description, url) {
        var ed = this.createExternalDocumentation();
        ed.description = description;
        ed.url = url;
        this.externalDocs = ed;
        return ed;
    };
    /**
     * Sets the external documentation information.
     * @param {string} description
     * @param {string} url
     * @return {ExternalDocumentation}
     */
    Document.prototype.setExternalDocumentation = function (description, url) {
        if (((typeof description === 'string') || description === null) && ((typeof url === 'string') || url === null)) {
            return this.setExternalDocumentation$java_lang_String$java_lang_String(description, url);
        }
        else if (((description != null && description instanceof ExternalDocumentation) || description === null) && url === undefined) {
            return this.setExternalDocumentation$io_apicurio_datamodels_core_models_common_ExternalDocumentation(description);
        }
        else
            throw new Error('invalid overload');
    };
    /**
     *
     * @return {boolean}
     */
    Document.prototype.isAttached = function () {
        return true;
    };
    return Document;
}(ExtensibleNode));
export { Document };
Document["__class"] = "io.apicurio.datamodels.core.models.Document";
Document["__interfaces"] = ["io.apicurio.datamodels.core.models.IVisitable", "io.apicurio.datamodels.core.models.common.IExternalDocumentationParent"];
//# sourceMappingURL=Document.js.map