"use strict";
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseLineRenderableSeries = void 0;
var BaseRenderableSeries_1 = require("./BaseRenderableSeries");
var constants_1 = require("./constants");
var LineSeriesDrawingProvider_1 = require("./DrawingProviders/LineSeriesDrawingProvider");
var PointMarkerDrawingProvider_1 = require("./DrawingProviders/PointMarkerDrawingProvider");
var LineSeriesHitTestProvider_1 = require("./HitTest/LineSeriesHitTestProvider");
var ELineType_1 = require("./types/ELineType");
var BaseLineRenderableSeries = /** @class */ (function (_super) {
    __extends(BaseLineRenderableSeries, _super);
    function BaseLineRenderableSeries(webAssemblyContext, options) {
        var _this = this;
        var _a;
        _this = _super.call(this, webAssemblyContext, options) || this;
        _this.strokeDashArrayProperty = [];
        _this.lineTypeProperty = ELineType_1.ELineType.Normal;
        _this.strokeDashArrayProperty = options === null || options === void 0 ? void 0 : options.strokeDashArray;
        _this.lineTypeProperty = (_a = options === null || options === void 0 ? void 0 : options.lineType) !== null && _a !== void 0 ? _a : _this.lineTypeProperty;
        if (options === null || options === void 0 ? void 0 : options.animation) {
            _this.animationQueue.push(options.animation);
        }
        return _this;
    }
    BaseLineRenderableSeries.prototype.addDrawingProviders = function (webAssemblyContext, options) {
        this.drawingProviders.push(new LineSeriesDrawingProvider_1.LineSeriesDrawingProvider(webAssemblyContext, this));
        this.drawingProviders.push(new PointMarkerDrawingProvider_1.PointMarkerDrawingProvider(webAssemblyContext, this));
    };
    /** @inheritDoc */
    BaseLineRenderableSeries.prototype.applyTheme = function (themeProvider) {
        _super.prototype.applyTheme.call(this, themeProvider);
        var previousThemeProvider = this.parentSurface.previousThemeProvider;
        if (this.stroke === previousThemeProvider.lineSeriesColor) {
            this.stroke = themeProvider.lineSeriesColor;
        }
    };
    Object.defineProperty(BaseLineRenderableSeries.prototype, "strokeDashArray", {
        /**
         * The StrokeDashArray defines the stroke or dash pattern for the line.
         * Accepts an array of values, e.g. [2,2] will have a line of length 2 and a gap of length 2.
         */
        get: function () {
            return this.strokeDashArrayProperty;
        },
        /**
         * The StrokeDashArray defines the stroke or dash pattern for the line.
         * Accepts an array of values, e.g. [2,2] will have a line of length 2 and a gap of length 2.
         */
        set: function (strokeDashArray) {
            this.strokeDashArrayProperty = strokeDashArray;
            this.notifyPropertyChanged(constants_1.PROPERTY.STROKE_DASH_ARRAY);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BaseLineRenderableSeries.prototype, "lineType", {
        /**
         * The type of line to draw.  One of {@link ELineType}. Replaces isDigitalLine
         */
        get: function () {
            return this.lineTypeProperty;
        },
        /**
         * The type of line to draw.  One of {@link ELineType}. Replaces isDigitalLine
         */
        set: function (lineType) {
            this.lineTypeProperty = lineType;
            this.notifyPropertyChanged(constants_1.PROPERTY.LINE_TYPE);
        },
        enumerable: false,
        configurable: true
    });
    /** @inheritDoc */
    BaseLineRenderableSeries.prototype.toJSON = function (excludeData) {
        if (excludeData === void 0) { excludeData = false; }
        var json = _super.prototype.toJSON.call(this, excludeData);
        var options = {
            strokeDashArray: this.strokeDashArray,
            lineType: this.lineTypeProperty
        };
        Object.assign(json.options, options);
        return json;
    };
    /**
     * @inheritDoc
     */
    BaseLineRenderableSeries.prototype.newHitTestProvider = function () {
        return new LineSeriesHitTestProvider_1.LineSeriesHitTestProvider(this, this.webAssemblyContext);
    };
    return BaseLineRenderableSeries;
}(BaseRenderableSeries_1.BaseRenderableSeries));
exports.BaseLineRenderableSeries = BaseLineRenderableSeries;
