import * as React from 'react';
import { TimeAxisIntervalType_$type } from "./TimeAxisIntervalType";
import { TimeAxisInterval } from "./TimeAxisInterval";
import { getModifiedProps, isValidProp, ensureEnum } from "igniteui-react-core/ES2015/componentUtil";
/**
 * Settings for an interval on a time axis.
 * Label intervals can be applied to a time axis, which are dynamic, according to the visible range.  During zooming, the visible range of the axis can change, and so a different interval is selected.  The interval selected will be the one with the largest range smaller than the visible range of the axis.
*
* The `IgrTimeAxisInterval` is used for settings the interval on a time axis.
*
* ```ts
*   <IgrDataChart
*     dataSource={this.state.dataSource}
*     width="700px"
*     height="500px">
*     <IgrOrdinalTimeXAxis name="xAxis" label="Date"
* 			dateTimeMemberPath="Date" />
*  </IgrDataChart>
* ```
*
* ```ts
*   <IgrDataChart
*     dataSource={this.state.dataSource}
*     width="700px"
*     height="500px">
*     <IgrTimeXAxis name="xAxis" label="Date"
* 			dateTimeMemberPath="Date" >
*
*  </IgrTimeXAxis>
*  </IgrDataChart>
* ```
*/
export class IgrTimeAxisInterval extends React.Component {
    constructor(props) {
        super(props);
        this._hasUserValues = new Set();
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    createImplementation() {
        return new TimeAxisInterval();
    }
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    get hasUserValues() {
        return this._hasUserValues;
    }
    componentDidMount() {
        for (const p of Object.keys(this.props)) {
            if (isValidProp(this, p)) {
                this._hasUserValues.add(p);
                this[p] = this.props[p];
            }
        }
    }
    shouldComponentUpdate(nextProps, nextState) {
        const mod = getModifiedProps(this.props, nextProps);
        for (const p of Object.keys(mod)) {
            if (isValidProp(this, p)) {
                this._hasUserValues.add(p);
                this[p] = mod[p];
            }
        }
        return true;
    }
    render() {
        return null;
    }
    /**
     * The visible axis range at which to apply this interval.
    *
    * Use `range` property for the visible axis range at which to apply this interval.
    *
    * ```ts
    *   <IgrDataChart
    *     dataSource={this.state.dataSource}
    *     width="700px"
    *     height="500px">
    *     <IgrOrdinalTimeXAxis name="xAxis" label="Date"
    * 			dateTimeMemberPath="Date" />
    *  </IgrDataChart>
    * ```
    *
    * ```ts
    *   <IgrDataChart
    *     dataSource={this.state.dataSource}
    *     width="700px"
    *     height="500px">
    *     <IgrTimeXAxis name="xAxis" label="Date"
    * 			dateTimeMemberPath="Date" >
    *
    *  </IgrTimeXAxis>
    *  </IgrDataChart>
    * ```
    */
    get range() {
        return this.i.k;
    }
    set range(v) {
        this.i.k = +v;
    }
    /**
     * The interval, expressed as a multiple of IntervalType.
    *
    * Use the `interval` property expressed as a multiple of IntervalType.
    *
    * ```ts
    *   <IgrDataChart
    *     dataSource={this.state.dataSource}
    *     width="700px"
    *     height="500px">
    *     <IgrOrdinalTimeXAxis name="xAxis" label="Date"
    * 			dateTimeMemberPath="Date" />
    *  </IgrDataChart>
    * ```
    *
    * ```ts
    *   <IgrDataChart
    *     dataSource={this.state.dataSource}
    *     width="700px"
    *     height="500px">
    *     <IgrTimeXAxis name="xAxis" label="Date"
    * 			dateTimeMemberPath="Date" >
    *
    *  </IgrTimeXAxis>
    *  </IgrDataChart>
    * ```
    */
    get interval() {
        return this.i.f;
    }
    set interval(v) {
        this.i.f = +v;
    }
    /**
     * The unit of time for this interval.
    *
    * The `intervalType` is the unit of time for this interval.
    *
    * ```ts
    *   <IgrDataChart
    *     dataSource={this.state.dataSource}
    *     width="700px"
    *     height="500px">
    *     <IgrOrdinalTimeXAxis name="xAxis" label="Date"
    * 			dateTimeMemberPath="Date" />
    *  </IgrDataChart>
    * ```
    *
    * ```ts
    *   <IgrDataChart
    *     dataSource={this.state.dataSource}
    *     width="700px"
    *     height="500px">
    *     <IgrTimeXAxis name="xAxis" label="Date"
    * 			dateTimeMemberPath="Date" >
    *
    *  </IgrTimeXAxis>
    *  </IgrDataChart>
    * ```
    */
    get intervalType() {
        return this.i.b;
    }
    set intervalType(v) {
        this.i.b = ensureEnum(TimeAxisIntervalType_$type, v);
    }
}
