import { DataLegendSeriesGroup_$type } from "./DataLegendSeriesGroup";
import { IgxDataLegendSeriesValueInfo } from "./igx-data-legend-series-value-info";
import { DataLegendSeriesContext as DataLegendSeriesContext_internal } from "./DataLegendSeriesContext";
import { ensureEnum } from "./componentUtil";
/**
 * Represent info about series values
*/
export class IgxDataLegendSeriesContext {
    constructor() {
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    createImplementation() {
        return new DataLegendSeriesContext_internal();
    }
    /**
     * @hidden
     */
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    _provideImplementation(i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    /**
     * Gets a group of series that the current series belongs to
    */
    get seriesGroup() {
        return this.i.b;
    }
    set seriesGroup(v) {
        this.i.b = ensureEnum(DataLegendSeriesGroup_$type, v);
    }
    findByName(name) {
        if (this.findEphemera) {
            if (name && name.indexOf("@@e:") == 0) {
                return this.findEphemera(name);
            }
        }
        return null;
    }
    /**
     * Creates an instance of DataLegendSeriesContext
    
    */
    getSeriesValueInfo(type) {
        let iv = this.i.c((type == null ? null : type));
        let ret = null;
        if (iv && iv.externalObject) {
            ret = iv.externalObject;
        }
        else {
            if (iv) {
                let e = new IgxDataLegendSeriesValueInfo();
                e._implementation = iv;
                iv.externalObject = e;
                ret = e;
            }
        }
        return ret;
    }
    /**
     * Gets value info for the series value type
    
    */
    getSeriesValue(type) {
        let iv = this.i.g((type == null ? null : type));
        return (iv);
    }
    setSeriesValue(type, value) {
        this.i.k((type == null ? null : type), value);
    }
    setSeriesValueInfo(type, valueInfo) {
        this.i.l((type == null ? null : type), (valueInfo == null ? null : valueInfo.i));
    }
    /**
     * Gets all values that a series renders at the current data point
     * For example, Open, High, Low, Close for Financial Series
    
    */
    getSeriesValues() {
        let iv = this.i.a();
        return (iv);
    }
}
