import { IgrRingSeriesBase } from "./igr-ring-series-base";
import { Ring as Ring_internal } from "./Ring";
import { toSize, fromSize, fromPoint, toPoint } from "igniteui-react-core";
/**
 * Represents data for
 * Ring.RingControl element.
*/
export class IgrRing {
    createImplementation() {
        return new Ring_internal();
    }
    /**
     * @hidden
     */
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    constructor() {
        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 index of ring in the chart.
    */
    get index() {
        return this.i.j;
    }
    set index(v) {
        this.i.j = +v;
    }
    /**
     * Gets the inner extend of the ring in percentage.
    */
    get innerExtend() {
        return this.i.h;
    }
    set innerExtend(v) {
        this.i.h = +v;
    }
    /**
     * Gets the size of the ring.
    */
    get controlSize() {
        return fromSize(this.i.q);
    }
    set controlSize(v) {
        this.i.q = toSize(v);
    }
    /**
     * Gets the center point of the ring.
    */
    get center() {
        return fromPoint(this.i.p);
    }
    set center(v) {
        this.i.p = toPoint(v);
    }
    /**
     * Gets reference to ring series.
    */
    get ringSeries() {
        const r = this.i.c;
        if (r == null) {
            return null;
        }
        if (!r.externalObject) {
            let e = IgrRingSeriesBase._createFromInternal(r);
            if (e) {
                e._implementation = r;
            }
            r.externalObject = e;
        }
        return r.externalObject;
    }
    set ringSeries(v) {
        v == null ? this.i.c = null : this.i.c = v.i;
    }
    /**
     * Gets the ring breadth.
    */
    get ringBreadth() {
        return this.i.i;
    }
    set ringBreadth(v) {
        this.i.i = +v;
    }
    findByName(name) {
        if (this.findEphemera) {
            if (name && name.indexOf("@@e:") == 0) {
                return this.findEphemera(name);
            }
        }
        if (this.ringSeries && this.ringSeries.name && this.ringSeries.name == name) {
            return this.ringSeries;
        }
        return null;
    }
    /**
     * Renders the arcs.
    
    */
    renderArcs() {
        let iv = this.i.f();
        return (iv);
    }
    /**
     * Prepares data needed to create
     * Arcs.
    
    */
    prepareArcs() {
        this.i.o();
    }
}
