import * as React from 'react';
import { delegateCombine, delegateRemove } from "igniteui-react-core/ES2015/type";
import { PropertyUpdatedEventArgs } from "igniteui-react-core/ES2015/igr-property-updated-event-args";
import { SizeScale } from "./SizeScale";
import { getModifiedProps, isValidProp, ensureBool } from "igniteui-react-core/ES2015/componentUtil";
/**
 * Represents a scale that is used determine an object's size.
*/
export class IgrSizeScale extends React.Component {
    constructor(props) {
        super(props);
        this._hasUserValues = new Set();
        this._propertyUpdated = null;
        this._propertyUpdated_wrapped = null;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    createImplementation() {
        return new SizeScale();
    }
    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;
    }
    /**
     * Gets or sets the minimum value for this scale.
    */
    get minimumValue() {
        return this.i.minimumValue;
    }
    set minimumValue(v) {
        this.i.minimumValue = +v;
    }
    /**
     * Gets or sets the maximum value for this scale.
    */
    get maximumValue() {
        return this.i.maximumValue;
    }
    set maximumValue(v) {
        this.i.maximumValue = +v;
    }
    /**
     * Gets or sets whether the scale is logarithmic.
    */
    get isLogarithmic() {
        return this.i.isLogarithmic;
    }
    set isLogarithmic(v) {
        this.i.isLogarithmic = ensureBool(v);
    }
    /**
     * Gets or sets the logarithm base for this scale.
    */
    get logarithmBase() {
        return this.i.logarithmBase;
    }
    set logarithmBase(v) {
        this.i.logarithmBase = +v;
    }
    /**
     * Event raised when a property (including "effective" and non-dependency property) value changes.
    */
    get propertyUpdated() {
        return this._propertyUpdated;
    }
    set propertyUpdated(ev) {
        if (this._propertyUpdated_wrapped !== null) {
            this.i.propertyUpdated = delegateRemove(this.i.propertyUpdated, this._propertyUpdated_wrapped);
            this._propertyUpdated_wrapped = null;
            this._propertyUpdated = null;
        }
        this._propertyUpdated = ev;
        this._propertyUpdated_wrapped = (o, e) => {
            let outerArgs = new PropertyUpdatedEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforePropertyUpdated) {
                this.beforePropertyUpdated(this, outerArgs);
            }
            if (this._propertyUpdated) {
                this._propertyUpdated(this, outerArgs);
            }
        };
        this.i.propertyUpdated = delegateCombine(this.i.propertyUpdated, this._propertyUpdated_wrapped);
    }
}
