import { IgrSeriesLayerPropertyOverlayCollection } from "./igr-series-layer-property-overlay-collection";
import { SeriesLayer as SeriesLayer_internal } from "./SeriesLayer";
import { SeriesLayerPropertyOverlayCollection as SeriesLayerPropertyOverlayCollection_internal } from "./SeriesLayerPropertyOverlayCollection";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { SyncableObservableCollection$1 } from "igniteui-react-core";
/**
 * Represents an axis annotation
*/
export class IgrSeriesLayer {
    createImplementation() {
        return new SeriesLayer_internal();
    }
    /**
     * @hidden
     */
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    constructor() {
        this.mounted = false;
        this._propertyOverlays = null;
        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();
        }
    }
    get transitionOutIsInProgress() {
        return this.i.t;
    }
    /**
     * Gets or sets the ZIndex to use for layering the series layers.
    */
    get zIndex() {
        return this.i.ac;
    }
    set zIndex(v) {
        this.i.ac = +v;
    }
    /**
     * Gets the current extra layers for the series.
    */
    get propertyOverlays() {
        if (this._propertyOverlays === null) {
            let coll = new IgrSeriesLayerPropertyOverlayCollection();
            let innerColl = this.i.m;
            if (!innerColl) {
                innerColl = new SeriesLayerPropertyOverlayCollection_internal();
            }
            this._propertyOverlays = coll._fromInner(innerColl);
        }
        return this._propertyOverlays;
    }
    set propertyOverlays(v) {
        if (this._propertyOverlays !== null) {
            this._propertyOverlays._setSyncTarget(null);
            this._propertyOverlays = null;
        }
        let coll = new IgrSeriesLayerPropertyOverlayCollection();
        this._propertyOverlays = coll._fromOuter(v);
        let syncColl = new SyncableObservableCollection$1(SeriesLayerPropertyOverlay.$type);
        let innerColl = this.i.m;
        if (!innerColl) {
            innerColl = new SeriesLayerPropertyOverlayCollection_internal();
        }
        syncColl._inner = innerColl;
        syncColl.clear();
        this._propertyOverlays._setSyncTarget(syncColl);
    }
    findByName(name) {
        if (this.findEphemera) {
            if (name && name.indexOf("@@e:") == 0) {
                return this.findEphemera(name);
            }
        }
        if (this.propertyOverlays != null && this.propertyOverlays.findByName && this.propertyOverlays.findByName(name)) {
            return this.propertyOverlays.findByName(name);
        }
        return null;
    }
    playTransitionOutAndRemove() {
        this.i.au();
    }
    playTransitionIn() {
        this.i.at();
    }
}
