"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.PolarMountainRenderableSeries = void 0;
var SeriesType_1 = require("../../../../types/SeriesType");
var IThemeProvider_1 = require("../../../Themes/IThemeProvider");
var ELineType_1 = require("../types/ELineType");
var BaseMountainRenderableSeries_1 = require("../BaseMountainRenderableSeries");
var constants_1 = require("../constants");
var PolarInterpolateLineRenderDataTransform_1 = require("../RenderDataTransforms/PolarInterpolateLineRenderDataTransform");
var PolarDataLabelProvider_1 = require("./DataLabels/PolarDataLabelProvider");
var PolarBandSeriesDrawingProvider_1 = require("./DrawingProviders/PolarBandSeriesDrawingProvider");
var PolarLineSeriesDrawingProvider_1 = require("./DrawingProviders/PolarLineSeriesDrawingProvider");
var PolarPointMarkerDrawingProvider_1 = require("./DrawingProviders/PolarPointMarkerDrawingProvider");
var PolarMountainSeriesHitTestProvider_1 = require("./HitTest/PolarMountainSeriesHitTestProvider");
/**
 * Defines a polar mountain/area series or JavaScript polar mountain chart type in the SciChart's High Performance Real-time
 * {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts}
 * @remarks
 * To add a polar mountain series to a {@link SciChartPolarSurface} you need to declare both the {@link PolarMountainRenderableSeries | RenderableSeries}
 * and a {@link XyDataSeries | DataSeries}. Simplified code sample below:
 *
 * ```ts
 * const { sciChartSurface, wasmContext } = SciChartPolarSurface.create(rootId);
 *
 * // Create the renderableSeries
 * const polarMountainSeries = new PolarMountainRenderableSeries(wasmContext, {
 *      dataSeries: new XyDataSeries(wasmContext, {
 *          xValues: [1, 2, 3, 4],
 *          yValues: [3, 2, 4, 1],
 *      }),
 *      fill: "#FFFFFF88"
 * });
 * // append to the SciChartSurface
 * sciChartPolarSurface.renderableSeries.add(polarMountainSeries);
 * ```
 *
 * ---
 * 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-types/polar-mountain-renderable-series/}
 */
var PolarMountainRenderableSeries = /** @class */ (function (_super) {
    __extends(PolarMountainRenderableSeries, _super);
    /**
     * Creates an instance of the {@link PolarMountainRenderableSeries}
     * @param webAssemblyContext The {@link TSciChart | SciChart WebAssembly Context} containing
     * native methods and access to our WebGL2 WebAssembly Drawing Engine
     * @param options optional parameters of type {@link IPolarMountainRenderableSeriesOptions} applied when constructing the series type
     *
     * ---
     * 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-types/polar-mountain-renderable-series/}
     */
    function PolarMountainRenderableSeries(webAssemblyContext, options) {
        var _this = this;
        var _a, _b, _c;
        _this = _super.call(this, webAssemblyContext, options) || this;
        _this.isPolar = true;
        _this.type = SeriesType_1.ESeriesType.PolarMountainSeries;
        _this.lineType = ELineType_1.ELineType.Normal;
        _this.interpolateLineProperty = false;
        if (!_this.dataLabelProviderProperty) {
            _this.dataLabelProviderProperty = new PolarDataLabelProvider_1.PolarDataLabelProvider(options === null || options === void 0 ? void 0 : options.dataLabels);
            _this.dataLabelProviderProperty.onAttach(_this.webAssemblyContext, _this);
        }
        _this.interpolateLineProperty = (_a = options === null || options === void 0 ? void 0 : options.interpolateLine) !== null && _a !== void 0 ? _a : _this.interpolateLineProperty;
        // Must be called here for the series type to be available
        if ((_b = _this.paletteProvider) === null || _b === void 0 ? void 0 : _b.onAttached) {
            (_c = _this.paletteProvider) === null || _c === void 0 ? void 0 : _c.onAttached(_this);
        }
        return _this;
    }
    Object.defineProperty(PolarMountainRenderableSeries.prototype, "isDigitalLine", {
        /** @inheritDoc */
        get: function () {
            return false;
        },
        enumerable: false,
        configurable: true
    });
    /** @inheritDoc */
    PolarMountainRenderableSeries.prototype.onAttach = function (scs) {
        _super.prototype.onAttach.call(this, scs);
        this.renderDataTransformProperty = new PolarInterpolateLineRenderDataTransform_1.PolarInterpolateLineRenderDataTransform(this, this.webAssemblyContext, [
            this.drawingProviders[0],
            this.drawingProviders[1]
        ]);
    };
    Object.defineProperty(PolarMountainRenderableSeries.prototype, "interpolateLine", {
        /**
         * Gets or sets the interpolation flag for line segments. If False each line segment draws normally.
         * If True each line segment draws as an arc.
         */
        get: function () {
            return this.interpolateLineProperty;
        },
        set: function (value) {
            if (this.interpolateLineProperty !== value) {
                this.interpolateLineProperty = value;
                this.notifyPropertyChanged("interpolateLine");
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarMountainRenderableSeries.prototype, "fillY1", {
        /**
         * Gets or sets the fill color for the region below the zero line as an HTML Color code
         */
        get: function () {
            return (0, IThemeProvider_1.stripAutoColor)(this.fillY1Property);
        },
        set: function (htmlColorCode) {
            this.fillY1Property = htmlColorCode;
            this.notifyPropertyChanged(constants_1.PROPERTY.FILL_Y1);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarMountainRenderableSeries.prototype, "fillLinearGradient1", {
        /**
         * Gets or sets the fill for the region below the zero line as a gradient brush
         */
        get: function () {
            return this.fillLinearGradient1Property;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarMountainRenderableSeries.prototype, "fillLinear1Gradient", {
        set: function (gradientBrushParams) {
            // We need this check, to prevent creating new Texture if we set the same value
            if (gradientBrushParams !== this.fillLinearGradient1Property) {
                this.fillLinearGradient1Property = gradientBrushParams;
                this.notifyPropertyChanged(constants_1.PROPERTY.FILL_LINEAR_GRADIENT);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarMountainRenderableSeries.prototype, "zeroLineY", {
        /** @inheritDoc */
        get: function () {
            return Math.max(this.zeroLineYProperty, this.xAxis.visibleRange.min);
        },
        enumerable: false,
        configurable: true
    });
    /** @inheritDoc */
    PolarMountainRenderableSeries.prototype.toJSON = function (excludeData) {
        if (excludeData === void 0) { excludeData = false; }
        var json = _super.prototype.toJSON.call(this, excludeData);
        var options = {
            interpolateLine: this.interpolateLine
        };
        Object.assign(json.options, options);
        return json;
    };
    /** @inheritDoc */
    PolarMountainRenderableSeries.prototype.addDrawingProviders = function (webAssemblyContext, options) {
        this.drawingProviders.push(new PolarBandSeriesDrawingProvider_1.PolarBandSeriesDrawingProvider(webAssemblyContext, this));
        this.drawingProviders.push(new PolarLineSeriesDrawingProvider_1.PolarLineSeriesDrawingProvider(webAssemblyContext, this));
        this.drawingProviders.push(new PolarPointMarkerDrawingProvider_1.PolarPointMarkerDrawingProvider(webAssemblyContext, this));
    };
    /** @inheritDoc */
    PolarMountainRenderableSeries.prototype.newHitTestProvider = function () {
        return new PolarMountainSeriesHitTestProvider_1.PolarMountainSeriesHitTestProvider(this, this.webAssemblyContext);
    };
    return PolarMountainRenderableSeries;
}(BaseMountainRenderableSeries_1.BaseMountainRenderableSeries));
exports.PolarMountainRenderableSeries = PolarMountainRenderableSeries;
