"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildAnnotations = void 0;
var ArcAnnotation_1 = require("../Charting/Visuals/Annotations/ArcAnnotation");
var PolarArcAnnotation_1 = require("../Charting/Visuals/Annotations/PolarArcAnnotation");
var AxisMarkerAnnotation_1 = require("../Charting/Visuals/Annotations/AxisMarkerAnnotation");
var BoxAnnotation_1 = require("../Charting/Visuals/Annotations/BoxAnnotation");
var CustomAnnotation_1 = require("../Charting/Visuals/Annotations/CustomAnnotation");
var HtmlCustomAnnotation_1 = require("../Charting/Visuals/Annotations/HtmlCustomAnnotation");
var HorizontalLineAnnotation_1 = require("../Charting/Visuals/Annotations/HorizontalLineAnnotation");
var HtmlTextAnnotation_1 = require("../Charting/Visuals/Annotations/HtmlTextAnnotation");
var EAnnotationType_1 = require("../Charting/Visuals/Annotations/types/EAnnotationType");
var LineAnnotation_1 = require("../Charting/Visuals/Annotations/LineAnnotation");
var LineArrowAnnotation_1 = require("../Charting/Visuals/Annotations/LineArrowAnnotation");
var NativeTextAnnotation_1 = require("../Charting/Visuals/Annotations/NativeTextAnnotation");
var PolarPointerAnnotation_1 = require("../Charting/Visuals/Annotations/PolarPointerAnnotation");
var TextAnnotation_1 = require("../Charting/Visuals/Annotations/TextAnnotation");
var VerticalLineAnnotation_1 = require("../Charting/Visuals/Annotations/VerticalLineAnnotation");
var BaseType_1 = require("../types/BaseType");
var chartReviver_1 = require("./helpers/chartReviver");
var classFactory_1 = require("../Core/classFactory");
var SvgLineAnnotation_1 = require("../Charting/Visuals/Annotations/SvgLineAnnotation");
var CompositeAnnotation_1 = require("../Charting/Visuals/Annotations/CompositeAnnotation");
// register annotations
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.RenderContextAxisMarkerAnnotation, function (options) { return new AxisMarkerAnnotation_1.AxisMarkerAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.RenderContextBoxAnnotation, function (options) { return new BoxAnnotation_1.BoxAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.RenderContextHorizontalLineAnnotation, function (options) { return new HorizontalLineAnnotation_1.HorizontalLineAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.RenderContextLineAnnotation, function (options) { return new LineAnnotation_1.LineAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.RenderContextVerticalLineAnnotation, function (options) { return new VerticalLineAnnotation_1.VerticalLineAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.SVGTextAnnotation, function (options) { return new TextAnnotation_1.TextAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.SVGCustomAnnotation, function (options) { return new CustomAnnotation_1.CustomAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.SVGPolarPointerAnnotation, function (options) { return new PolarPointerAnnotation_1.PolarPointerAnnotation(options); });
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.HtmlTextAnnotation, function (options) { return new HtmlTextAnnotation_1.HtmlTextAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.RenderContextNativeTextAnnotation, function (options) { return new NativeTextAnnotation_1.NativeTextAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.RenderContextArcAnnotation, function (options) { return new ArcAnnotation_1.ArcAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.HtmlCustomAnnotation, function (options) { return new HtmlCustomAnnotation_1.HtmlCustomAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.RenderContextLineArrowAnnotation, function (options) { return new LineArrowAnnotation_1.LineArrowAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.RenderContextPolarArcAnnotation, function (options) { return new PolarArcAnnotation_1.PolarArcAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.SvgLineAnnotation, function (options) { return new SvgLineAnnotation_1.SvgLineAnnotation(options); }, true);
(0, classFactory_1.registerType)(BaseType_1.EBaseType.Annotation, EAnnotationType_1.EAnnotationType.CompositeAnnotation, function (options) { return new CompositeAnnotation_1.CompositeAnnotation(options); }, true);
/**
 * Build one or more annotations from a definition that can be pure data.
 * @param definition One or an array of {@link TAnnotationDefinition}
 * @returns An array of annotations
 */
var buildAnnotations = function (definition) {
    if (typeof definition === "string") {
        definition = JSON.parse(definition, chartReviver_1.chartReviver);
    }
    var annotations = [];
    if (Array.isArray(definition)) {
        for (var _i = 0, definition_1 = definition; _i < definition_1.length; _i++) {
            var annotation = definition_1[_i];
            annotations.push((0, classFactory_1.createType)(BaseType_1.EBaseType.Annotation, annotation.type, null, annotation.options));
        }
    }
    else {
        annotations.push((0, classFactory_1.createType)(BaseType_1.EBaseType.Annotation, definition.type, null, definition.options));
    }
    return annotations;
};
exports.buildAnnotations = buildAnnotations;
