# Source: editor/DocumentValidatedEvent.js

    /** @constant {number} */
    export const SEVERITY_NONE = 0;

    /** @constant {number} */
    export const SEVERITY_INVALID_REFERENCE = 1;

    /** @constant {number} */
    export const SEVERITY_SEMANTIC_WARNING = 2;

    /** @constant {number} */
    export const SEVERITY_SEMANTIC_ERROR = 3;

    /** @constant {number} */
    export const SEVERITY_INVALID_DATA = 4;

    /** @constant {number} */
    export const SEVERITY_INVALID_STRUCTURE = 5;

    /**
     * {@link XMLEditorEvent} sent after the document being edited
     * in an {@link XMLEditor} is validated, either automatically
     * (for example, when the document is opened or saved) or
     * on demand by the user.
     *
     * <p>This event contains all the information needed to a update
     * a validity state indicator or a pane listing validity errors.
     */
    export class DocumentValidatedEvent extends XMLEditorEvent {
        constructor(xmlEditor, data) {
            super(xmlEditor, data, "documentValidated");

            this._severity = this._diagnostics.severity;
            this._diagnostics = this._diagnostics.diagnostics;
        }

        /**
         * Get the <code>severity</code> property of this event:
         * the overall severity of the diagnostics.
         *
         * @type {number}
         */
        get severity() {
            return this._severity;
        }

        /**
         * Get the <code>diagnostics</code> property of this event:
         * a possibly empty array of <dfn>diagnostic objects</dfn>.
         *
         * <p>A <dfn>diagnostic object</dfn> has the following keys:
         * <dl>
         * <dt><code>elementUID</code></dt>
         * <dd>UID of the element where this error was found.</dd>
         * <dt><code>message</code></dt>
         * <dd>Message describing the error.</dd>
         * <dt><code>severity</code></dt>
         * <dd>The severity of the error.
         * An integer between {@link SEVERITY_NONE} and
         * {@link SEVERITY_INVALID_STRUCTURE}</dd>
         * <dt><code>detail</code></dt>
         * <dd>A <dfn>detail</dfn> about the error; generally <code>null</code>.
         * <p>Otherwise an array starting with a key and following by one or
         * more values. <dfn>Detail</dfn> keys are strings:
         * <dl>
         * <dt><code>"BROKEN_IDREF"</code></dt>
         * <dd>An IDREF pointing to an unknown ID.
         * Value is the unknown ID.</dd>
         * <dt><code>"BROKEN_LINK"</code></dt>
         * <dd>Similar to BROKEN_IDREF but applies to a link which is
         * a generalization of an IDREF.</dd>
         * <dt><code>"DUPLICATE_ID"</code></dt>
         * <dd>Mutiply-defined ID. Value is the duplicate ID, plus, optionally,
         * the UID of the element bearing the original ID.</dd>
         * <dt><code>"DUPLICATE_ANCHOR"</code></dt>
         * <dd>Similar to DUPLICATE_ID but applies to an anchor which is
         * a generalization of an ID.</dd>
         * <dt><code>"ORIGINAL_ID"</code></dt>
         * <dd><code>elementUID</code> specifies the element bearing
         * the original ID. Value is this original ID.</dd>
         * <dt><code>"ORIGINAL_ANCHOR"</code></dt>
         * <dd>Similar to ORIGINAL_ID but applies to an anchor which is
         * a generalization of an ID.</dd>
         * <dt><code>"BAD_ATTRIBUTE_NAME"</code></dt>
         * <dd>An attribute having an invalid value.
         * Value is the qualified name of the attribute.</dd>
         * </dl>
         * </dd>
         * </dl>
         *
         * @type {array}
         */
        get diagnostics() {
            return this._diagnostics;
        }
    }