import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrSeries } from "./igr-series";
import { CalloutCollisionMode_$type } from "./CalloutCollisionMode";
import { IgrCalloutStyleUpdatingEventArgs } from "./igr-callout-style-updating-event-args";
import { IgrCalloutContentUpdatingEventArgs } from "./igr-callout-content-updating-event-args";
import { IgrCalloutLabelUpdatingEventArgs } from "./igr-callout-label-updating-event-args";
import { IgrCalloutSeriesSelectingEventArgs } from "./igr-callout-series-selecting-event-args";
import { IgrAnnotationLayer } from "./igr-annotation-layer";
import { CalloutLayer } from "./CalloutLayer";
import { ensureBool, brushToString, stringToBrush, ensureEnum } from "igniteui-react-core";
/**
 * Represents an annotation layer that displays crosshair lines that cross through the closest value of the target series under the cursor.
*/
export class IgrCalloutLayer extends IgrAnnotationLayer {
    constructor(props) {
        super(props);
        this._calloutStyleUpdating = null;
        this._calloutStyleUpdating_wrapped = null;
        this._calloutContentUpdating = null;
        this._calloutContentUpdating_wrapped = null;
        this._calloutLabelUpdating = null;
        this._calloutLabelUpdating_wrapped = null;
        this._calloutSeriesSelecting = null;
        this._calloutSeriesSelecting_wrapped = null;
    }
    createImplementation() {
        return new CalloutLayer();
    }
    /**
                                 * @hidden
                                 */
    get i() {
        return this._implementation;
    }
    /**
     * Gets or sets the label mapping property for the callouts.
    */
    get labelMemberPath() {
        return this.i.rm;
    }
    set labelMemberPath(v) {
        this.i.rm = v;
    }
    /**
     * Gets or sets the label mapping property for the callouts.
    */
    get xMemberPath() {
        return this.i.rv;
    }
    set xMemberPath(v) {
        this.i.rv = v;
    }
    /**
     * Gets or sets the label mapping property for the callouts.
    */
    get yMemberPath() {
        return this.i.ry;
    }
    set yMemberPath(v) {
        this.i.ry = v;
    }
    /**
     * Gets or sets the key mapping property for the callouts.
    */
    get keyMemberPath() {
        return this.i.rj;
    }
    set keyMemberPath(v) {
        this.i.rj = v;
    }
    /**
     * Gets or sets whether to allow the callouts to be variable distances from the target points, for suppporting collision modes.
    */
    get isCalloutOffsettingEnabled() {
        return this.i.p8;
    }
    set isCalloutOffsettingEnabled(v) {
        this.i.p8 = ensureBool(v);
    }
    /**
     * Gets or sets the content mapping property for the callouts.
    */
    get contentMemberPath() {
        return this.i.rd;
    }
    set contentMemberPath(v) {
        this.i.rd = v;
    }
    /**
     * Gets or sets the name of the series series to target this annotation to. If null, this annotation targets all series simultaneously.
    */
    get targetSeriesName() {
        return this.i.ro;
    }
    set targetSeriesName(v) {
        this.i.ro = v;
    }
    /**
     * Gets or sets the series to target this annotation to. If null, this annotation targets all series simultaneously.
    */
    get targetSeries() {
        if (this.i.pj == null) {
            return null;
        }
        if (!this.i.pj.externalObject) {
            let e = IgrSeries._createFromInternal(this.i.pj);
            if (e) {
                e._implementation = this.i.pj;
            }
            this.i.pj.externalObject = e;
        }
        return this.i.pj.externalObject;
    }
    set targetSeries(v) {
        if (v != null && this._stylingContainer && v._styling)
            v._styling(this._stylingContainer, this, this);
        v == null ? this.i.pj = null : this.i.pj = v.i;
    }
    /**
     * Gets or sets a channel name to identify other callout layers within the chart to share collision information with.
    */
    get collisionChannel() {
        return this.i.ra;
    }
    set collisionChannel(v) {
        this.i.ra = v;
    }
    /**
     * Gets or sets how to select the final value to annotate.
    */
    get isAutoCalloutBehaviorEnabled() {
        return this.i.p7;
    }
    set isAutoCalloutBehaviorEnabled(v) {
        this.i.p7 = ensureBool(v);
    }
    /**
     * Gets or sets whether to use values, rather than labels for auto callout labels.
    */
    get useValueForAutoCalloutLabels() {
        return this.i.qa;
    }
    set useValueForAutoCalloutLabels(v) {
        this.i.qa = ensureBool(v);
    }
    /**
     * Gets or sets whether to allow for custom callout styles.
    */
    get isCustomCalloutStyleEnabled() {
        return this.i.p9;
    }
    set isCustomCalloutStyleEnabled(v) {
        this.i.p9 = ensureBool(v);
    }
    /**
     * Gets or sets the precision to use when values are used for the auto callout labels.
    */
    get autoCalloutLabelPrecision() {
        return this.i.qs;
    }
    set autoCalloutLabelPrecision(v) {
        this.i.qs = +v;
    }
    /**
     * Gets or sets the color to use for the callout text. Leave unset for an automatic value.
    */
    get calloutTextColor() {
        return brushToString(this.i.s7);
    }
    set calloutTextColor(v) {
        this.i.s7 = stringToBrush(v);
    }
    /**
     * Gets or sets the brush that specifies how the backgrounds for the callouts of the layer are painted. Leave unset for an automatic value.
    */
    get calloutBackground() {
        return brushToString(this.i.s4);
    }
    set calloutBackground(v) {
        this.i.s4 = stringToBrush(v);
    }
    /**
     * Gets or sets the precision to use displaying values for interpolated crosshair positions.
    */
    get calloutInterpolatedValuePrecision() {
        return this.i.qt;
    }
    set calloutInterpolatedValuePrecision(v) {
        this.i.qt = +v;
    }
    /**
     * Gets or sets the brush that specifies how the outlines for the callouts of the layer are painted.
    */
    get calloutOutline() {
        return brushToString(this.i.s6);
    }
    set calloutOutline(v) {
        this.i.s6 = stringToBrush(v);
    }
    /**
     * Gets or sets the brush that specifies how the leader lines for the callouts of the layer are painted.
    */
    get calloutLeaderBrush() {
        return brushToString(this.i.s5);
    }
    set calloutLeaderBrush(v) {
        this.i.s5 = stringToBrush(v);
    }
    /**
     * Gets or sets the left padding to use withing the callout. Leaving this NaN will use an automatic value related to the axis label margins.
    */
    get calloutPaddingLeft() {
        return this.i.ql;
    }
    set calloutPaddingLeft(v) {
        this.i.ql = +v;
    }
    /**
     * Gets or sets the top padding to use within the callout. Leaving this NaN will use an automatic value related to the axis label margins.
    */
    get calloutPaddingTop() {
        return this.i.qn;
    }
    set calloutPaddingTop(v) {
        this.i.qn = +v;
    }
    /**
     * Gets or sets the right padding to use within the callout. Leaving this NaN will use an automatic value related to the axis label margins.
    */
    get calloutPaddingRight() {
        return this.i.qm;
    }
    set calloutPaddingRight(v) {
        this.i.qm = +v;
    }
    /**
     * Gets or sets the bottom padding to use within the callout. Leaving this NaN will use an automatic value related to the axis label margins.
    */
    get calloutPaddingBottom() {
        return this.i.qk;
    }
    set calloutPaddingBottom(v) {
        this.i.qk = +v;
    }
    /**
     * Gets or sets the strategy to use for avoiding collisions between the callouts in this layer. Leave unset for an automatic value.
    */
    get calloutCollisionMode() {
        return this.i.pd;
    }
    set calloutCollisionMode(v) {
        this.i.pd = ensureEnum(CalloutCollisionMode_$type, v);
    }
    /**
     * Gets or sets the padding to add to the callout positioning. Leave unset for an automatic value.
    */
    get calloutPositionPadding() {
        return this.i.qo;
    }
    set calloutPositionPadding(v) {
        this.i.qo = +v;
    }
    /**
     * Gets or sets the stroke thickness for the callout backing. Leave unset for an automatic value.
    */
    get calloutStrokeThickness() {
        return this.i.qp;
    }
    set calloutStrokeThickness(v) {
        this.i.qp = +v;
    }
    /**
     * Gets or sets the stroke thickness for the axis annotation backing. Leave unset for an automatic value.
    */
    get textStyle() {
        return this.i.rr;
    }
    set textStyle(v) {
        this.i.rr = v;
    }
    findByName(name) {
        var baseResult = super.findByName(name);
        if (baseResult) {
            return baseResult;
        }
        if (this.targetSeries && this.targetSeries.name && this.targetSeries.name == name) {
            return this.targetSeries;
        }
        return null;
    }
    _styling(container, component, parent) {
        super._styling(container, component, parent);
        this._inStyling = true;
        if (this.targetSeries && this.targetSeries._styling) {
            this.targetSeries._styling(container, component, this);
        }
        this._inStyling = false;
    }
    getItemValue(item, memberPathName) {
        let iv = this.i.gt(item, memberPathName);
        return (iv);
    }
    /**
     * Invalidates content of callout layer
    
    */
    invalidateCalloutContent() {
        this.i.r7();
    }
    /**
     * Event raised when updating style of callout layer
    */
    get calloutStyleUpdating() {
        return this._calloutStyleUpdating;
    }
    set calloutStyleUpdating(ev) {
        if (this._calloutStyleUpdating_wrapped !== null) {
            this.i.calloutStyleUpdating = delegateRemove(this.i.calloutStyleUpdating, this._calloutStyleUpdating_wrapped);
            this._calloutStyleUpdating_wrapped = null;
            this._calloutStyleUpdating = null;
        }
        this._calloutStyleUpdating = ev;
        this._calloutStyleUpdating_wrapped = (o, e) => {
            let outerArgs = new IgrCalloutStyleUpdatingEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeCalloutStyleUpdating) {
                this.beforeCalloutStyleUpdating(this, outerArgs);
            }
            if (this._calloutStyleUpdating) {
                this._calloutStyleUpdating(this, outerArgs);
            }
        };
        this.i.calloutStyleUpdating = delegateCombine(this.i.calloutStyleUpdating, this._calloutStyleUpdating_wrapped);
    }
    /**
     * Raised to allow you to decide on the content for an automatically created callout.
    */
    get calloutContentUpdating() {
        return this._calloutContentUpdating;
    }
    set calloutContentUpdating(ev) {
        if (this._calloutContentUpdating_wrapped !== null) {
            this.i.calloutContentUpdating = delegateRemove(this.i.calloutContentUpdating, this._calloutContentUpdating_wrapped);
            this._calloutContentUpdating_wrapped = null;
            this._calloutContentUpdating = null;
        }
        this._calloutContentUpdating = ev;
        this._calloutContentUpdating_wrapped = (o, e) => {
            let outerArgs = new IgrCalloutContentUpdatingEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeCalloutContentUpdating) {
                this.beforeCalloutContentUpdating(this, outerArgs);
            }
            if (this._calloutContentUpdating) {
                this._calloutContentUpdating(this, outerArgs);
            }
        };
        this.i.calloutContentUpdating = delegateCombine(this.i.calloutContentUpdating, this._calloutContentUpdating_wrapped);
    }
    /**
     * Raised to allow you to decide on the label for an automatically created callout.
    */
    get calloutLabelUpdating() {
        return this._calloutLabelUpdating;
    }
    set calloutLabelUpdating(ev) {
        if (this._calloutLabelUpdating_wrapped !== null) {
            this.i.calloutLabelUpdating = delegateRemove(this.i.calloutLabelUpdating, this._calloutLabelUpdating_wrapped);
            this._calloutLabelUpdating_wrapped = null;
            this._calloutLabelUpdating = null;
        }
        this._calloutLabelUpdating = ev;
        this._calloutLabelUpdating_wrapped = (o, e) => {
            let outerArgs = new IgrCalloutLabelUpdatingEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeCalloutLabelUpdating) {
                this.beforeCalloutLabelUpdating(this, outerArgs);
            }
            if (this._calloutLabelUpdating) {
                this._calloutLabelUpdating(this, outerArgs);
            }
        };
        this.i.calloutLabelUpdating = delegateCombine(this.i.calloutLabelUpdating, this._calloutLabelUpdating_wrapped);
    }
    /**
     * Raised to allow you to select a target series for a data bound callout.
    */
    get calloutSeriesSelecting() {
        return this._calloutSeriesSelecting;
    }
    set calloutSeriesSelecting(ev) {
        if (this._calloutSeriesSelecting_wrapped !== null) {
            this.i.calloutSeriesSelecting = delegateRemove(this.i.calloutSeriesSelecting, this._calloutSeriesSelecting_wrapped);
            this._calloutSeriesSelecting_wrapped = null;
            this._calloutSeriesSelecting = null;
        }
        this._calloutSeriesSelecting = ev;
        this._calloutSeriesSelecting_wrapped = (o, e) => {
            let outerArgs = new IgrCalloutSeriesSelectingEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeCalloutSeriesSelecting) {
                this.beforeCalloutSeriesSelecting(this, outerArgs);
            }
            if (this._calloutSeriesSelecting) {
                this._calloutSeriesSelecting(this, outerArgs);
            }
        };
        this.i.calloutSeriesSelecting = delegateCombine(this.i.calloutSeriesSelecting, this._calloutSeriesSelecting_wrapped);
    }
}
//# sourceMappingURL=igr-callout-layer.js.map
