import { FinancialCalculationDataSource as FinancialCalculationDataSource_internal } from "./FinancialCalculationDataSource";
import { ensureBool } from "igniteui-react-core/ES5/componentUtil";
/**
 * Represents the data contract between a financial series and the
 * decoupled calculation responsibilities which implement its mathmatical logic.
 * The FinancialCalculationDataSource contract represents the subset
 * of data which needs to be provided in order to test or run a calculation,
 * and its intentionally a subset of the information available to the series,
 * in order to make calculation strategies more easily testable and usable in isolation to
 * the financial series container.
*/
var FinancialCalculationDataSource = /** @class */ (function () {
    function FinancialCalculationDataSource() {
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    FinancialCalculationDataSource.prototype.createImplementation = function () {
        return new FinancialCalculationDataSource_internal();
    };
    Object.defineProperty(FinancialCalculationDataSource.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    FinancialCalculationDataSource.prototype.onImplementationCreated = function () {
    };
    FinancialCalculationDataSource.prototype._provideImplementation = function (i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    };
    Object.defineProperty(FinancialCalculationDataSource.prototype, "openColumn", {
        get: function () {
            return this.i.series.getOpenColumnAsArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "highColumn", {
        get: function () {
            return this.i.series.getHighColumnAsArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "lowColumn", {
        get: function () {
            return this.i.series.getLowColumnAsArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "closeColumn", {
        get: function () {
            return this.i.series.getCloseColumnAsArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "volumeColumn", {
        get: function () {
            return this.i.series.getVolumeColumnAsArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "indicatorColumn", {
        get: function () {
            return this.i.series.indicatorColumn.asArray();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "typicalColumn", {
        /**
     * An enumerable list of typical prices provided by the series to use
     * in calculations.
    */
        get: function () {
            if (this.i.typicalColumn == null) {
                return null;
            }
            return this.i.typicalColumn.externalObject;
        },
        set: function (v) {
            v == null ? this.i.typicalColumn = null : this.i.typicalColumn = v.i;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "trueRange", {
        /**
         * And enumerable list of true range values provided by the series to use
         * in calculations.
        */
        get: function () {
            if (this.i.trueRange == null) {
                return null;
            }
            return this.i.trueRange.externalObject;
        },
        set: function (v) {
            v == null ? this.i.trueRange = null : this.i.trueRange = v.i;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "trueLow", {
        /**
         * An enumerable list of true low values provided by the series to use
         * in calculations.
        */
        get: function () {
            if (this.i.trueLow == null) {
                return null;
            }
            return this.i.trueLow.externalObject;
        },
        set: function (v) {
            v == null ? this.i.trueLow = null : this.i.trueLow = v.i;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "period", {
        /**
         * The period to use when calculating, if applicable.
        */
        get: function () {
            return this.i.period;
        },
        set: function (v) {
            this.i.period = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "shortPeriod", {
        /**
         * The short period to use when calculating, if applicable.
        */
        get: function () {
            return this.i.shortPeriod;
        },
        set: function (v) {
            this.i.shortPeriod = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "longPeriod", {
        /**
         * The long period to use when calculating, if applicable.
        */
        get: function () {
            return this.i.longPeriod;
        },
        set: function (v) {
            this.i.longPeriod = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "count", {
        /**
         * The count of the values in the series.
        */
        get: function () {
            return this.i.count;
        },
        set: function (v) {
            this.i.count = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "calculateFrom", {
        /**
         * The starting index from which to calculate
        */
        get: function () {
            return this.i.calculateFrom;
        },
        set: function (v) {
            this.i.calculateFrom = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "calculateCount", {
        /**
         * The number of items from the starting index from which to calculate
        */
        get: function () {
            return this.i.calculateCount;
        },
        set: function (v) {
            this.i.calculateCount = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "multiplier", {
        /**
         * If the calculation supports some sort of scaling factor,
         * this value will be used.
        */
        get: function () {
            return this.i.multiplier;
        },
        set: function (v) {
            this.i.multiplier = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "minimumValue", {
        /**
         * If the calculation determines the range of indicator values,
         * it will set the minimum and maximux properties.
         * This will contain the previous minimum value when the indicator
         * calculation is called again, in case this makes the update of the
         * value speedier.
        */
        get: function () {
            return this.i.minimumValue;
        },
        set: function (v) {
            this.i.minimumValue = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "maximumValue", {
        /**
         * If the calculation determines the range of indicator values,
         * it will set the minimum and maximux properties.
         * This will contain the previous minimum value when the indicator
         * calculation is called again, in case this makes the update of the
         * value speedier.
        */
        get: function () {
            return this.i.maximumValue;
        },
        set: function (v) {
            this.i.maximumValue = +v;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FinancialCalculationDataSource.prototype, "specifiesRange", {
        /**
         * The calculation strategy should set this to true if it
         * specifes the minimum and maximum value properties.
        */
        get: function () {
            return this.i.specifiesRange;
        },
        set: function (v) {
            this.i.specifiesRange = ensureBool(v);
        },
        enumerable: true,
        configurable: true
    });
    return FinancialCalculationDataSource;
}());
export { FinancialCalculationDataSource };
