import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrNumericAngleAxis } from "./igr-numeric-angle-axis";
import { IgrNumericRadiusAxis } from "./igr-numeric-radius-axis";
import { TrendLineType_$type } from "igniteui-react-core";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { IgrAssigningPolarStyleEventArgs } from "./igr-assigning-polar-style-event-args";
import { IgrAssigningPolarMarkerStyleEventArgs } from "./igr-assigning-polar-marker-style-event-args";
import { IgrMarkerSeries } from "./igr-marker-series";
import { ensureBool, ensureEnum, brushToString, stringToBrush, toDoubleCollection, fromDoubleCollection, toPoint, fromPoint } from "igniteui-react-core";
/**
 * Represents the base class from which all IgxDataChartComponent polar series are derived.
*/
export class IgrPolarBase extends IgrMarkerSeries {
    /**
                                 * @hidden
                                 */
    get i() {
        return this._implementation;
    }
    constructor(props) {
        super(props);
        this._angleAxisName = null;
        this._radiusAxisName = null;
        this._assigningPolarStyle = null;
        this._assigningPolarStyle_wrapped = null;
        this._assigningPolarMarkerStyle = null;
        this._assigningPolarMarkerStyle_wrapped = null;
    }
    /**
     * Checks if this series is a polar series
    */
    get isPolar() {
        return this.i.fp;
    }
    /**
     * Gets or sets the path to use to find the angle values for the series.
    */
    get angleMemberPath() {
        return this.i.aah;
    }
    set angleMemberPath(v) {
        this.i.aah = v;
    }
    /**
     * Gets or sets the path to use to get the radius values for the series.
    */
    get radiusMemberPath() {
        return this.i.aaz;
    }
    set radiusMemberPath(v) {
        this.i.aaz = v;
    }
    /**
     * Gets or sets the highlighted radius value mapping property for the current series object.
    */
    get highlightedRadiusMemberPath() {
        return this.i.aam;
    }
    set highlightedRadiusMemberPath(v) {
        this.i.aam = v;
    }
    /**
     * Gets or sets the highlighted angle value mapping property for the current series object.
    */
    get highlightedAngleMemberPath() {
        return this.i.aak;
    }
    set highlightedAngleMemberPath(v) {
        this.i.aak = v;
    }
    /**
     * Gets the effective angle axis for the current series object.
    */
    get angleAxis() {
        const r = this.i.yr;
        if (r == null) {
            return null;
        }
        if (!r.externalObject) {
            let e = IgrNumericAngleAxis._createFromInternal(r);
            if (e) {
                e._implementation = r;
            }
            r.externalObject = e;
        }
        return r.externalObject;
    }
    set angleAxis(v) {
        if (v != null && this._stylingContainer && v._styling)
            v._styling(this._stylingContainer, this, this);
        v == null ? this.i.yr = null : this.i.yr = v.i;
    }
    /**
    * Gets or sets the name to use to resolve angleAxis from markup.
    */
    get angleAxisName() {
        return this._angleAxisName;
    }
    set angleAxisName(v) {
        this._angleAxisName = v;
    }
    /**
     * Gets the effective radius axis for the current series object.
    */
    get radiusAxis() {
        const r = this.i.ys;
        if (r == null) {
            return null;
        }
        if (!r.externalObject) {
            let e = IgrNumericRadiusAxis._createFromInternal(r);
            if (e) {
                e._implementation = r;
            }
            r.externalObject = e;
        }
        return r.externalObject;
    }
    set radiusAxis(v) {
        if (v != null && this._stylingContainer && v._styling)
            v._styling(this._stylingContainer, this, this);
        v == null ? this.i.ys = null : this.i.ys = v.i;
    }
    /**
    * Gets or sets the name to use to resolve radiusAxis from markup.
    */
    get radiusAxisName() {
        return this._radiusAxisName;
    }
    set radiusAxisName(v) {
        this._radiusAxisName = v;
    }
    /**
     * Gets or sets whether Cartesian Interpolation should be used rather than Archimedian
     * spiral based interpolation.
    */
    get useCartesianInterpolation() {
        return this.i.zx;
    }
    set useCartesianInterpolation(v) {
        this.i.zx = ensureBool(v);
    }
    /**
     * Gets or sets the maximum number of markers displayed by the current series.
     * If more than the specified number of markers are visible, the polar series will automatically
     * choose a representative set.
    */
    get maximumMarkers() {
        return this.i.z7;
    }
    set maximumMarkers(v) {
        this.i.z7 = +v;
    }
    /**
     * Gets or sets the trend type for the current series object.
    */
    get trendLineType() {
        return this.i.y9;
    }
    set trendLineType(v) {
        this.i.y9 = ensureEnum(TrendLineType_$type, v);
    }
    /**
     * Gets or sets the brush that specifies how the current series
     * object's trend line is drawn.
    */
    get trendLineBrush() {
        return brushToString(this.i.ab6);
    }
    set trendLineBrush(v) {
        this.i.ab6 = stringToBrush(v);
    }
    /**
     * Gets the effective TrendLineBrush for this series.
    */
    get actualTrendLineBrush() {
        return brushToString(this.i.ab5);
    }
    set actualTrendLineBrush(v) {
        this.i.ab5 = stringToBrush(v);
    }
    /**
     * Gets or sets the thickness of the current series object's trend line.
    */
    get trendLineThickness() {
        return this.i.z5;
    }
    set trendLineThickness(v) {
        this.i.z5 = +v;
    }
    /**
     * Gets or sets a collection of double values that indicate the pattern of dashes and gaps that
     * is used to draw the trend line for the current series object.
    */
    get trendLineDashArray() {
        return fromDoubleCollection(this.i.ab7);
    }
    set trendLineDashArray(v) {
        this.i.ab7 = toDoubleCollection(v);
    }
    /**
     * Gets or sets the moving average period for the current series object.
    */
    get trendLinePeriod() {
        return this.i.z8;
    }
    set trendLinePeriod(v) {
        this.i.z8 = +v;
    }
    /**
     * Sets or Gets the Trendline Z index.
    */
    get trendLineZIndex() {
        return this.i.z9;
    }
    set trendLineZIndex(v) {
        this.i.z9 = +v;
    }
    /**
     * Gets or sets whether to clip the series to the bounds.
     * Setting this to true can effect performance.
    */
    get clipSeriesToBounds() {
        return this.i.zn;
    }
    set clipSeriesToBounds(v) {
        this.i.zn = ensureBool(v);
    }
    get actualItemSearchMode() {
        return this.i.y5;
    }
    set actualItemSearchMode(v) {
        this.i.y5 = ensureEnum(ScatterItemSearchMode_$type, v);
    }
    /**
     * Gets or sets the mode the series will use to find the closest point to the cursor.
    */
    get itemSearchMode() {
        return this.i.y7;
    }
    set itemSearchMode(v) {
        this.i.y7 = ensureEnum(ScatterItemSearchMode_$type, v);
    }
    /**
     * Gets or sets the threshold to use when searching for items using ItemSearchMode.
    */
    get itemSearchThreshold() {
        return this.i.z6;
    }
    set itemSearchThreshold(v) {
        this.i.z6 = +v;
    }
    /**
     * Gets or sets whether this Polar series should allow custom style overrides of its individual visuals.
    */
    get isCustomPolarStyleAllowed() {
        return this.i.zq;
    }
    set isCustomPolarStyleAllowed(v) {
        this.i.zq = ensureBool(v);
    }
    /**
     * Gets or sets whether this Polar series should allow custom style overrides of its individual marker visuals.
    */
    get isCustomPolarMarkerStyleAllowed() {
        return this.i.zp;
    }
    set isCustomPolarMarkerStyleAllowed(v) {
        this.i.zp = ensureBool(v);
    }
    /**
     * Gets or sets the label displayed before series' radius value in the Data Legend.
    */
    get radiusMemberAsLegendLabel() {
        return this.i.aav;
    }
    set radiusMemberAsLegendLabel(v) {
        this.i.aav = v;
    }
    /**
     * Gets or sets the label displayed before series' angle value in the Data Legend.
    */
    get angleMemberAsLegendLabel() {
        return this.i.aad;
    }
    set angleMemberAsLegendLabel(v) {
        this.i.aad = v;
    }
    /**
     * Gets or sets the unit displayed after series' radius value in the Data Legend.
    */
    get radiusMemberAsLegendUnit() {
        return this.i.aax;
    }
    set radiusMemberAsLegendUnit(v) {
        this.i.aax = v;
    }
    /**
     * Gets or sets the unit displayed after series' angle value in the Data Legend.
    */
    get angleMemberAsLegendUnit() {
        return this.i.aaf;
    }
    set angleMemberAsLegendUnit(v) {
        this.i.aaf = v;
    }
    bindAxes(axes) {
        super.bindAxes(axes);
        for (let i = 0; i < axes.length; i++) {
            if (this.angleAxisName && this.angleAxisName.length > 0 &&
                axes[i].name == this.angleAxisName) {
                this.angleAxis = axes[i];
            }
        }
        for (let i = 0; i < axes.length; i++) {
            if (this.radiusAxisName && this.radiusAxisName.length > 0 &&
                axes[i].name == this.radiusAxisName) {
                this.radiusAxis = axes[i];
            }
        }
    }
    findByName(name) {
        var baseResult = super.findByName(name);
        if (baseResult) {
            return baseResult;
        }
        if (this.angleAxis && this.angleAxis.name && this.angleAxis.name == name) {
            return this.angleAxis;
        }
        if (this.radiusAxis && this.radiusAxis.name && this.radiusAxis.name == name) {
            return this.radiusAxis;
        }
        return null;
    }
    _styling(container, component, parent) {
        super._styling(container, component, parent);
        this._inStyling = true;
        if (this.angleAxis && this.angleAxis._styling) {
            this.angleAxis._styling(container, component, this);
        }
        if (this.radiusAxis && this.radiusAxis._styling) {
            this.radiusAxis._styling(container, component, this);
        }
        this._inStyling = false;
    }
    /**
     * Scrolls the requested item into view, if possible.
    
    * @param item  * The item to scroll into view.
    */
    scrollIntoView(item) {
        let iv = this.i.gd(item);
        return (iv);
    }
    /**
     * Gets the item that is the best match for the specified world coordinates.
    
    * @param world  * The world coordinates to use.
    */
    getItem(world) {
        let iv = this.i.kn(toPoint(world));
        return (iv);
    }
    /**
     * Gets the index of the item that resides at the provided world coordinates.
    
    * @param world  * The world coordinates of the requested item.
    */
    getItemIndex(world) {
        let iv = this.i.j3(toPoint(world));
        return (iv);
    }
    getExactItemIndex(world) {
        let iv = this.i.ir(toPoint(world));
        return (iv);
    }
    getSeriesValuePosition(world, useInterpolation, skipUnknowns) {
        let iv = this.i.wa(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    }
    getItemValue(item, memberPathName) {
        let iv = this.i.kq(item, memberPathName);
        return (iv);
    }
    /**
     * Gets the value of a requested member path from the series.
    
    * @param memberPathName  * The property name of a valid member path for the series
    */
    getMemberPathValue(memberPathName) {
        let iv = this.i.md(memberPathName);
        return (iv);
    }
    /**
     * Determine if object can be used as RadiusAxis
    
    * @param axis  * The object to check
    */
    canUseAsRadiusAxis(axis) {
        let iv = this.i.zm(axis);
        return (iv);
    }
    /**
     * Determine if object can be used as AngleAxis
    
    * @param axis  * The object to check
    */
    canUseAsAngleAxis(axis) {
        let iv = this.i.zl(axis);
        return (iv);
    }
    /**
     * Event raised when Assigning Category Style
    */
    get assigningPolarStyle() {
        return this._assigningPolarStyle;
    }
    set assigningPolarStyle(ev) {
        if (this._assigningPolarStyle_wrapped !== null) {
            this.i.assigningPolarStyle = delegateRemove(this.i.assigningPolarStyle, this._assigningPolarStyle_wrapped);
            this._assigningPolarStyle_wrapped = null;
            this._assigningPolarStyle = null;
        }
        this._assigningPolarStyle = ev;
        this._assigningPolarStyle_wrapped = (o, e) => {
            let outerArgs = new IgrAssigningPolarStyleEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeAssigningPolarStyle) {
                this.beforeAssigningPolarStyle(this, outerArgs);
            }
            if (this._assigningPolarStyle) {
                this._assigningPolarStyle(this, outerArgs);
            }
        };
        this.i.assigningPolarStyle = delegateCombine(this.i.assigningPolarStyle, this._assigningPolarStyle_wrapped);
        ;
    }
    /**
     * Event raised when Assigning Polar Marker Style
    */
    get assigningPolarMarkerStyle() {
        return this._assigningPolarMarkerStyle;
    }
    set assigningPolarMarkerStyle(ev) {
        if (this._assigningPolarMarkerStyle_wrapped !== null) {
            this.i.assigningPolarMarkerStyle = delegateRemove(this.i.assigningPolarMarkerStyle, this._assigningPolarMarkerStyle_wrapped);
            this._assigningPolarMarkerStyle_wrapped = null;
            this._assigningPolarMarkerStyle = null;
        }
        this._assigningPolarMarkerStyle = ev;
        this._assigningPolarMarkerStyle_wrapped = (o, e) => {
            let outerArgs = new IgrAssigningPolarMarkerStyleEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeAssigningPolarMarkerStyle) {
                this.beforeAssigningPolarMarkerStyle(this, outerArgs);
            }
            if (this._assigningPolarMarkerStyle) {
                this._assigningPolarMarkerStyle(this, outerArgs);
            }
        };
        this.i.assigningPolarMarkerStyle = delegateCombine(this.i.assigningPolarMarkerStyle, this._assigningPolarMarkerStyle_wrapped);
        ;
    }
}
