import { IgrHighlightingInfo } from "igniteui-react-core";
import { TypeRegistrar } from "igniteui-react-core";
import { brushToString, stringToBrush, ensureBool } from "igniteui-react-core";
/**
 * Represents event arguments base class for the AssigningCategoryStyleEventArgsBase
*/
export class IgrAssigningSeriesStyleEventArgsBase {
    createImplementation() {
        return null;
    }
    /**
     * @hidden
     */
    get i() {
        return this._implementation;
    } /**
                                 * @hidden
                                 */
    static _createFromInternal(internal) {
        if (!internal) {
            return null;
        }
        if (!internal.$type) {
            return null;
        }
        let name = internal.$type.name;
        let externalName = "Igr" + name;
        if (!TypeRegistrar.isRegistered(externalName)) {
            return null;
        }
        return TypeRegistrar.create(externalName);
    }
    onImplementationCreated() {
    }
    constructor() {
        this.mounted = false;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
        if (this._initializeAdapters) {
            this._initializeAdapters();
        }
    }
    _provideImplementation(i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
        if (this._initializeAdapters) {
            this._initializeAdapters();
        }
    }
    /**
     * Gets the start index
    */
    get startIndex() {
        return this.i.o;
    }
    set startIndex(v) {
        this.i.o = +v;
    }
    /**
     * Gets the end index
    */
    get endIndex() {
        return this.i.n;
    }
    set endIndex(v) {
        this.i.n = +v;
    }
    /**
     * Gets the start date, if applicable
    */
    get startDate() {
        return this.i.h;
    }
    set startDate(v) {
        this.i.h = v;
    }
    /**
     * Gets the end date, if applicable
    */
    get endDate() {
        return this.i.g;
    }
    set endDate(v) {
        this.i.g = v;
    }
    /**
     * Gets a function that will return the items associated with this event.
    */
    get getItems() {
        return this.i.a;
    }
    set getItems(v) {
        this.i.a = v;
    }
    /**
     * Gets or sets fill brush to use for the current item.
    */
    get fill() {
        return brushToString(this.i.p);
    }
    set fill(v) {
        this.i.p = stringToBrush(v);
    }
    /**
     * Gets or sets stroke to use for the current item.
    */
    get stroke() {
        return brushToString(this.i.q);
    }
    set stroke(v) {
        this.i.q = stringToBrush(v);
    }
    /**
     * Gets or sets opacity to use for the current item.
    */
    get opacity() {
        return this.i.k;
    }
    set opacity(v) {
        this.i.k = +v;
    }
    /**
     * Gets or sets opacity to use for the current item.
    */
    get fadeOpacity() {
        return this.i.i;
    }
    set fadeOpacity(v) {
        this.i.i = +v;
    }
    /**
     * Gets or sets highlighting info
    */
    get highlightingInfo() {
        const r = this.i.b;
        if (r == null) {
            return null;
        }
        if (!r.externalObject) {
            let e = new IgrHighlightingInfo();
            if (r.$type) {
                e._implementation = r;
            }
            else {
                if (e.i.setNativeElement) {
                    e.i.setNativeElement(r);
                }
            }
            r.externalObject = e;
        }
        return r.externalObject;
    }
    set highlightingInfo(v) {
        v == null ? this.i.b = null : this.i.b = v.i;
    }
    /**
     * Gets the max highlighting progress from all series.
    */
    get maxAllSeriesHighlightingProgress() {
        return this.i.j;
    }
    set maxAllSeriesHighlightingProgress(v) {
        this.i.j = +v;
    }
    /**
     * Gets the sum of highlighting progress from all series.
    */
    get sumAllSeriesHighlightingProgress() {
        return this.i.l;
    }
    set sumAllSeriesHighlightingProgress(v) {
        this.i.l = +v;
    }
    /**
     * Gets the average of highlighting progress from all the series.
    */
    get totalAllSeriesHighlightingProgress() {
        return this.i.m;
    }
    set totalAllSeriesHighlightingProgress(v) {
        this.i.m = +v;
    }
    /**
     * Gets or sets if highlighting was handled by this event handler, and whether internal highlighting logic should be skipped.
    */
    get highlightingHandled() {
        return this.i.d;
    }
    set highlightingHandled(v) {
        this.i.d = ensureBool(v);
    }
    /**
     * Gets if this event has a valid date range
    */
    get hasDateRange() {
        return this.i.c;
    }
    set hasDateRange(v) {
        this.i.c = ensureBool(v);
    }
    /**
     * Gets if the current shape is identified as a negative shape if this series supports discrete negative shapes.
    */
    get isNegativeShape() {
        return this.i.e;
    }
    set isNegativeShape(v) {
        this.i.e = ensureBool(v);
    }
    /**
     * Gets if the current event is being raised for the thumbnail image.
    */
    get isThumbnail() {
        return this.i.f;
    }
    set isThumbnail(v) {
        this.i.f = ensureBool(v);
    }
    findByName(name) {
        if (this.findEphemera) {
            if (name && name.indexOf("@@e:") == 0) {
                return this.findEphemera(name);
            }
        }
        if (this.highlightingInfo && this.highlightingInfo.name && this.highlightingInfo.name == name) {
            return this.highlightingInfo;
        }
        return null;
    }
}
