"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.XmlDocumentType = void 0;
const XmlNode_js_1 = require("./XmlNode.js");
/**
 * A document type declaration within an XML document.
 *
 * @example
 *
 * ```xml
 * <!DOCTYPE kittens [
 *   <!ELEMENT kittens (#PCDATA)>
 * ]>
 * ```
 */
class XmlDocumentType extends XmlNode_js_1.XmlNode {
    constructor(name, publicId, systemId, internalSubset) {
        super();
        this.name = name;
        this.publicId = publicId ?? null;
        this.systemId = systemId ?? null;
        this.internalSubset = internalSubset ?? null;
    }
    get type() {
        return XmlNode_js_1.XmlNode.TYPE_DOCUMENT_TYPE;
    }
    toJSON() {
        let json = XmlNode_js_1.XmlNode.prototype.toJSON.call(this);
        json.name = this.name;
        for (let key of ['publicId', 'systemId', 'internalSubset']) {
            if (this[key] !== null) {
                json[key] = this[key];
            }
        }
        return json;
    }
}
exports.XmlDocumentType = XmlDocumentType;
//# sourceMappingURL=XmlDocumentType.js.map