import { delegateCombine, delegateRemove } from "igniteui-react-core/ES2015/type";
import { FinancialChartVolumeType_$type } from "./FinancialChartVolumeType";
import { FinancialChartXAxisMode_$type } from "./FinancialChartXAxisMode";
import { FinancialChartYAxisMode_$type } from "./FinancialChartYAxisMode";
import { FinancialChartType_$type } from "./FinancialChartType";
import { HorizontalAlignment_$type } from "igniteui-react-core/ES2015/HorizontalAlignment";
import { FinancialIndicatorTypeCollection } from "./igr-financial-indicator-type-collection";
import { FinancialOverlayTypeCollection } from "./igr-financial-overlay-type-collection";
import { AxisLabelsLocation_$type } from "./AxisLabelsLocation";
import { FinancialChartZoomSliderType_$type } from "./FinancialChartZoomSliderType";
import { IndicatorDisplayTypeCollection } from "./igr-indicator-display-type-collection";
import { FinancialChartRangeSelectorOptionCollection } from "./igr-financial-chart-range-selector-option-collection";
import { CustomIndicatorNameCollection } from "./igr-custom-indicator-name-collection";
import { FinancialChartCustomIndicatorArgs } from "./igr-financial-chart-custom-indicator-args";
import { IgrXYChart } from "./igr-xy-chart";
import { FinancialChart } from "./FinancialChart";
import { ensureBool, ensureEnum, toBrushCollection, fromBrushCollection, brushToString, stringToBrush } from "igniteui-react-core/ES2015/componentUtil";
import { FinancialIndicatorTypeCollection as FinancialIndicatorTypeCollection_internal } from "./FinancialIndicatorTypeCollection";
import { FinancialOverlayTypeCollection as FinancialOverlayTypeCollection_internal } from "./FinancialOverlayTypeCollection";
import { IndicatorDisplayTypeCollection as IndicatorDisplayTypeCollection_internal } from "./IndicatorDisplayTypeCollection";
import { FinancialChartRangeSelectorOptionCollection as FinancialChartRangeSelectorOptionCollection_internal } from "./FinancialChartRangeSelectorOptionCollection";
import { CustomIndicatorNameCollection as CustomIndicatorNameCollection_internal } from "./CustomIndicatorNameCollection";
/**
 * Represents a chart with an ordinal X-axis and a numeric Y-axis.
*/
export class IgrFinancialChart extends IgrXYChart {
    constructor(props) {
        super(props);
        this._indicatorTypes = null;
        this._overlayTypes = null;
        this._indicatorDisplayTypes = null;
        this._rangeSelectorOptions = null;
        this._customIndicatorNames = null;
        this._applyCustomIndicators = null;
        this._applyCustomIndicators_wrapped = null;
    }
    createImplementation() {
        return new FinancialChart();
    }
    get i() {
        return this._implementation;
    }
    get leftMargin() {
        return this.i.bw;
    }
    set leftMargin(v) {
        this.i.bw = +v;
    }
    get isHorizontalZoomEnabled() {
        return this.i.ay;
    }
    set isHorizontalZoomEnabled(v) {
        this.i.ay = ensureBool(v);
    }
    get toolbarHeight() {
        return this.i.qp;
    }
    set toolbarHeight(v) {
        this.i.qp = +v;
    }
    /**
     * Gets or sets whether the Y-axis should use a logarithmic scale instead of a linear one.
     * Since log(-1) is imaginary and log(0) is undefined, it is recommended to enable this property only when the Y-axis minimum is greater than zero.
    */
    get yAxisIsLogarithmic() {
        return this.i.p2;
    }
    set yAxisIsLogarithmic(v) {
        this.i.p2 = ensureBool(v);
    }
    /**
     * Gets or sets the base value to use in the log function when mapping the position of data items along the Y-axis.
     * This property is effective only when YAxisIsLogarithmic is true.
    */
    get yAxisLogarithmBase() {
        return this.i.rh;
    }
    set yAxisLogarithmBase(v) {
        this.i.rh = +v;
    }
    /**
     * Gets or sets the distance between each label and grid line along the Y-axis.
    */
    get yAxisInterval() {
        return this.i.qt;
    }
    set yAxisInterval(v) {
        this.i.qt = +v;
    }
    /**
     * Gets or sets the data value corresponding to the minimum value of the Y-axis.
    */
    get yAxisMinimumValue() {
        return this.i.qv;
    }
    set yAxisMinimumValue(v) {
        this.i.qv = +v;
    }
    /**
     * Gets or sets the data value corresponding to the maximum value of the Y-axis.
    */
    get yAxisMaximumValue() {
        return this.i.qu;
    }
    set yAxisMaximumValue(v) {
        this.i.qu = +v;
    }
    /**
     * Gets or sets the frequency of displayed minor lines along the Y-axis.
    */
    get yAxisMinorInterval() {
        return this.i.qw;
    }
    set yAxisMinorInterval(v) {
        this.i.qw = +v;
    }
    /**
     * Gets the current minimum value for the Y-axis.
    */
    get yAxisActualMinimum() {
        return this.i.qs;
    }
    /**
     * Gets the current maximum value for the Y-axis.
    */
    get yAxisActualMaximum() {
        return this.i.qr;
    }
    /**
     * The type of series to display in the volume pane.
    */
    get volumeType() {
        return this.i.n4;
    }
    set volumeType(v) {
        this.i.n4 = ensureEnum(FinancialChartVolumeType_$type, v);
    }
    /**
     * The scaling mode of the X-axis.
    */
    get xAxisMode() {
        return this.i.n6;
    }
    set xAxisMode(v) {
        this.i.n6 = ensureEnum(FinancialChartXAxisMode_$type, v);
    }
    /**
     * The scaling mode of the Y-axis.
    */
    get yAxisMode() {
        return this.i.n8;
    }
    set yAxisMode(v) {
        this.i.n8 = ensureEnum(FinancialChartYAxisMode_$type, v);
    }
    /**
     * A boolean property controlling the visibility of the toolbar.
    */
    get isToolbarVisible() {
        return this.i.px;
    }
    set isToolbarVisible(v) {
        this.i.px = ensureBool(v);
    }
    /**
     * The type of price series to display in the main chart.
    */
    get chartType() {
        return this.i.nz;
    }
    set chartType(v) {
        this.i.nz = ensureEnum(FinancialChartType_$type, v);
    }
    /**
     * Gets or sets Horizontal alignment of Y-axis labels.
    */
    get yAxisLabelHorizontalAlignment() {
        return this.i.lv;
    }
    set yAxisLabelHorizontalAlignment(v) {
        this.i.lv = ensureEnum(HorizontalAlignment_$type, v);
    }
    /**
     * A boolean indicating whether the chart should automatically zoom in vertically on the currently visible range of data.
     * When this property is set to true, panning and zooming along the X-axis will result in a corresponding zoom on the Y-axis, so that the visible range of data fills the zoom window as fully as possible.
    */
    get isWindowSyncedToVisibleRange() {
        return this.i.py;
    }
    set isWindowSyncedToVisibleRange(v) {
        this.i.py = ensureBool(v);
    }
    /**
     * A collection indicating what financial indicator types to display on the Financial Chart.
    */
    get indicatorTypes() {
        if (this._indicatorTypes === null) {
            let coll = new FinancialIndicatorTypeCollection();
            let innerColl = this.i.od;
            let wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new FinancialIndicatorTypeCollection_internal(0);
            }
            this._indicatorTypes = coll._fromInner(innerColl);
            if (wasNull) {
                this.i.od = innerColl;
            }
        }
        return this._indicatorTypes;
    }
    set indicatorTypes(v) {
        let coll = new FinancialIndicatorTypeCollection();
        this._indicatorTypes = coll._fromOuter(v);
        let innerColl = new FinancialIndicatorTypeCollection_internal(0);
        let va = typeof v == 'string' ? coll._splitOuter(v) : v;
        innerColl._inner = va.map(item => coll._ensureOuter(item));
        this.i.od = innerColl;
    }
    /**
     * A collection indicating what financial overlay types to display on the Financial Chart.
    */
    get overlayTypes() {
        if (this._overlayTypes === null) {
            let coll = new FinancialOverlayTypeCollection();
            let innerColl = this.i.of;
            let wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new FinancialOverlayTypeCollection_internal(0);
            }
            this._overlayTypes = coll._fromInner(innerColl);
            if (wasNull) {
                this.i.of = innerColl;
            }
        }
        return this._overlayTypes;
    }
    set overlayTypes(v) {
        let coll = new FinancialOverlayTypeCollection();
        this._overlayTypes = coll._fromOuter(v);
        let innerColl = new FinancialOverlayTypeCollection_internal(0);
        let va = typeof v == 'string' ? coll._splitOuter(v) : v;
        innerColl._inner = va.map(item => coll._ensureOuter(item));
        this.i.of = innerColl;
    }
    /**
     * Gets or sets whether the large numbers on the Y-axis labels are abbreviated.
    */
    get yAxisAbbreviateLargeNumbers() {
        return this.i.p1;
    }
    set yAxisAbbreviateLargeNumbers(v) {
        this.i.p1 = ensureBool(v);
    }
    /**
     * Gets or sets the rendering resolution for all series in this chart.
     * Where n = Resolution, for every n horizontal pixels, combine all items into a single datapoint.  When Resolution = 0, all datapoints will be rendered as graphical objects.  Charts with a higher resolution will have faster performance.
    */
    get resolution() {
        return this.i.by;
    }
    set resolution(v) {
        this.i.by = +v;
    }
    /**
     * The location of Y-axis labels, relative to the plot area.
    */
    get yAxisLabelLocation() {
        return this.i.gr;
    }
    set yAxisLabelLocation(v) {
        this.i.gr = ensureEnum(AxisLabelsLocation_$type, v);
    }
    /**
     * The type of series to display in the zoom slider pane.
    */
    get zoomSliderType() {
        return this.i.ob;
    }
    set zoomSliderType(v) {
        this.i.ob = ensureEnum(FinancialChartZoomSliderType_$type, v);
    }
    /**
     * Gets or sets the palette used for coloring negative items of Waterfall chart type.
    */
    get negativeBrushes() {
        return fromBrushCollection(this.i.m8);
    }
    set negativeBrushes(v) {
        this.i.m8 = toBrushCollection(v);
    }
    /**
     * Brushes to use for drawing negative elements, when using a chart type with contextual coloring, such as Waterfall.
    */
    get negativeOutlines() {
        return fromBrushCollection(this.i.m9);
    }
    set negativeOutlines(v) {
        this.i.m9 = toBrushCollection(v);
    }
    /**
     * Brushes to use for filling financial overlays.
    */
    get overlayBrushes() {
        return fromBrushCollection(this.i.na);
    }
    set overlayBrushes(v) {
        this.i.na = toBrushCollection(v);
    }
    /**
     * Brushes to use for outlining financial overlays.
    */
    get overlayOutlines() {
        return fromBrushCollection(this.i.nb);
    }
    set overlayOutlines(v) {
        this.i.nb = toBrushCollection(v);
    }
    /**
     * Brushes to use for outlining volume series in the volume pane.
    */
    get volumeOutlines() {
        return fromBrushCollection(this.i.nd);
    }
    set volumeOutlines(v) {
        this.i.nd = toBrushCollection(v);
    }
    /**
     * Brushes to use for filling volume series in the volume pane.
    */
    get volumeBrushes() {
        return fromBrushCollection(this.i.nc);
    }
    set volumeBrushes(v) {
        this.i.nc = toBrushCollection(v);
    }
    /**
     * Brushes to use for negative elements in financial indicators.
    */
    get indicatorNegativeBrushes() {
        return fromBrushCollection(this.i.m7);
    }
    set indicatorNegativeBrushes(v) {
        this.i.m7 = toBrushCollection(v);
    }
    /**
     * Brushes to use for financial indicators.
    */
    get indicatorBrushes() {
        return fromBrushCollection(this.i.m6);
    }
    set indicatorBrushes(v) {
        this.i.m6 = toBrushCollection(v);
    }
    /**
     * The outline thickness of volume series in the volume pane.
    */
    get volumeThickness() {
        return this.i.qq;
    }
    set volumeThickness(v) {
        this.i.qq = +v;
    }
    /**
     * The outline thickness of financial overlays.
    */
    get overlayThickness() {
        return this.i.qo;
    }
    set overlayThickness(v) {
        this.i.qo = +v;
    }
    /**
     * The outline or stroke thickness of financial indicators.
    */
    get indicatorThickness() {
        return this.i.qn;
    }
    set indicatorThickness(v) {
        this.i.qn = +v;
    }
    /**
     * The display types of financial indicators.
    */
    get indicatorDisplayTypes() {
        if (this._indicatorDisplayTypes === null) {
            let coll = new IndicatorDisplayTypeCollection();
            let innerColl = this.i.op;
            let wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new IndicatorDisplayTypeCollection_internal();
            }
            this._indicatorDisplayTypes = coll._fromInner(innerColl);
            if (wasNull) {
                this.i.op = innerColl;
            }
        }
        return this._indicatorDisplayTypes;
    }
    set indicatorDisplayTypes(v) {
        let coll = new IndicatorDisplayTypeCollection();
        this._indicatorDisplayTypes = coll._fromOuter(v);
        let innerColl = new IndicatorDisplayTypeCollection_internal();
        let va = typeof v == 'string' ? coll._splitOuter(v) : v;
        innerColl._inner = va.map(item => coll._ensureOuter(item));
        this.i.op = innerColl;
    }
    /**
     * The period of financial indicators, where applicable.
    */
    get indicatorPeriod() {
        return this.i.rc;
    }
    set indicatorPeriod(v) {
        this.i.rc = +v;
    }
    /**
     * The multiplier of financial indicators, where applicable.
    */
    get indicatorMultiplier() {
        return this.i.qm;
    }
    set indicatorMultiplier(v) {
        this.i.qm = +v;
    }
    /**
     * The smoothing period of financial indicators, where applicable.
    */
    get indicatorSmoothingPeriod() {
        return this.i.rf;
    }
    set indicatorSmoothingPeriod(v) {
        this.i.rf = +v;
    }
    /**
     * The short period of financial indicators, where applicable.
    */
    get indicatorShortPeriod() {
        return this.i.rd;
    }
    set indicatorShortPeriod(v) {
        this.i.rd = +v;
    }
    /**
     * The long period of financial indicators, where applicable.
    */
    get indicatorLongPeriod() {
        return this.i.rb;
    }
    set indicatorLongPeriod(v) {
        this.i.rb = +v;
    }
    /**
     * The signal period of financial indicators, where applicable.
    */
    get indicatorSignalPeriod() {
        return this.i.re;
    }
    set indicatorSignalPeriod(v) {
        this.i.re = +v;
    }
    /**
     * A FinancialChartRangeSelectorOptionCollection containing the available range selector options on the toolbar.
    */
    get rangeSelectorOptions() {
        if (this._rangeSelectorOptions === null) {
            let coll = new FinancialChartRangeSelectorOptionCollection();
            let innerColl = this.i.nv;
            let wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new FinancialChartRangeSelectorOptionCollection_internal(0);
            }
            this._rangeSelectorOptions = coll._fromInner(innerColl);
            if (wasNull) {
                this.i.nv = innerColl;
            }
        }
        return this._rangeSelectorOptions;
    }
    set rangeSelectorOptions(v) {
        let coll = new FinancialChartRangeSelectorOptionCollection();
        this._rangeSelectorOptions = coll._fromOuter(v);
        let innerColl = new FinancialChartRangeSelectorOptionCollection_internal(0);
        let va = typeof v == 'string' ? coll._splitOuter(v) : v;
        innerColl._inner = va.map(item => coll._ensureOuter(item));
        this.i.nv = innerColl;
    }
    /**
     * The names of custom indicators to add to the chart.
     * When CustomIndicatorNames is set, the ApplyCustomIndicators event will be raised for each custom indicator name.
    */
    get customIndicatorNames() {
        if (this._customIndicatorNames === null) {
            let coll = new CustomIndicatorNameCollection();
            let innerColl = this.i.customIndicatorNames;
            let wasNull = false;
            if (!innerColl) {
                wasNull = true;
                innerColl = new CustomIndicatorNameCollection_internal(0);
            }
            this._customIndicatorNames = coll._fromInner(innerColl);
            if (wasNull) {
                this.i.customIndicatorNames = innerColl;
            }
        }
        return this._customIndicatorNames;
    }
    set customIndicatorNames(v) {
        let coll = new CustomIndicatorNameCollection();
        this._customIndicatorNames = coll._fromOuter(v);
        let innerColl = new CustomIndicatorNameCollection_internal(0);
        let va = typeof v == 'string' ? coll._splitOuter(v) : v;
        innerColl._inner = va.map(item => coll._ensureOuter(item));
        this.i.customIndicatorNames = innerColl;
    }
    get isVerticalZoomEnabled() {
        return this.i.a3;
    }
    set isVerticalZoomEnabled(v) {
        this.i.a3 = ensureBool(v);
    }
    get zoomSliderXAxisMajorStroke() {
        return brushToString(this.i.u9);
    }
    set zoomSliderXAxisMajorStroke(v) {
        this.i.u9 = stringToBrush(v);
    }
    get zoomSliderXAxisMajorStrokeThickness() {
        return this.i.qx;
    }
    set zoomSliderXAxisMajorStrokeThickness(v) {
        this.i.qx = +v;
    }
    get isLegendVisible() {
        return this.i.pt;
    }
    set isLegendVisible(v) {
        this.i.pt = ensureBool(v);
    }
    provideContainer(container) {
        this.i.provideContainer(container);
    }
    notifyInsertItem(source_, index, newItem) {
        this.i.e9(source_, index, newItem);
    }
    notifyRemoveItem(source_, index, oldItem) {
        this.i.fa(source_, index, oldItem);
    }
    notifyClearItems(source_) {
        this.i.e8(source_);
    }
    notifySetItem(source_, index, oldItem, newItem) {
        this.i.fc(source_, index, oldItem, newItem);
    }
    /**
     * Returns visuals as a serialized string.
    
    */
    exportSerializedVisualData() {
        let iv = this.i.r1();
        return (iv);
    }
    /**
     * Event raised by the chart when custom indicator data is needed from the application.
     * During series rendering, event will be raised once for each value in the CustomIndicatorNames collection.
    */
    get applyCustomIndicators() {
        return this._applyCustomIndicators;
    }
    set applyCustomIndicators(ev) {
        if (this._applyCustomIndicators !== null) {
            this.i.applyCustomIndicators = delegateRemove(this.i.applyCustomIndicators, this._applyCustomIndicators_wrapped);
            this._applyCustomIndicators_wrapped = null;
            this._applyCustomIndicators = null;
        }
        this._applyCustomIndicators = ev;
        this._applyCustomIndicators_wrapped = (o, e) => {
            let outerArgs = new FinancialChartCustomIndicatorArgs();
            outerArgs._provideImplementation(e);
            this._applyCustomIndicators(this, outerArgs);
        };
        this.i.applyCustomIndicators = delegateCombine(this.i.applyCustomIndicators, this._applyCustomIndicators_wrapped);
    }
}
