import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { DataSourceSummaryOperand_$type } from "igniteui-react-core";
import { IgrProvideCalculatorEventArgs } from "igniteui-react-core";
import { ChartSummaryDescription as ChartSummaryDescription_internal } from "./ChartSummaryDescription";
import { ensureEnum } from "igniteui-react-core";
/**
 * Represents a summary that is applied to a datasource. Changes to this object are not observed or expected after it is initially assigned to a collection.
*/
var IgrChartSummaryDescription = /** @class */ /*@__PURE__*/ (function () {
    function IgrChartSummaryDescription() {
        this.mounted = false;
        this._provideCalculator = null;
        this._provideCalculator_wrapped = null;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
        if (this._initializeAdapters) {
            this._initializeAdapters();
        }
    }
    IgrChartSummaryDescription.prototype.createImplementation = function () {
        return new ChartSummaryDescription_internal(0);
    };
    Object.defineProperty(IgrChartSummaryDescription.prototype, "i", {
        /**
         * @hidden
         */
        get: function () {
            return this._implementation;
        },
        enumerable: false,
        configurable: true
    });
    IgrChartSummaryDescription.prototype.onImplementationCreated = function () {
    };
    IgrChartSummaryDescription.prototype._provideImplementation = function (i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
        if (this._initializeAdapters) {
            this._initializeAdapters();
        }
    };
    Object.defineProperty(IgrChartSummaryDescription.prototype, "field", {
        get: function () {
            return this.i.p;
        },
        set: function (v) {
            this.i.p = v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrChartSummaryDescription.prototype, "operand", {
        get: function () {
            return this.i.c;
        },
        set: function (v) {
            this.i.c = ensureEnum(DataSourceSummaryOperand_$type, v);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrChartSummaryDescription.prototype, "alias", {
        /**
         * Gets or sets an alias for the summary. Currently only used in aggregated data situations.
        */
        get: function () {
            return this.i.n;
        },
        set: function (v) {
            this.i.n = v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrChartSummaryDescription.prototype, "calculatorDisplayName", {
        /**
         * Gets or sets the name to use when displaying the calculator name.
        */
        get: function () {
            return this.i.o;
        },
        set: function (v) {
            this.i.o = v;
        },
        enumerable: false,
        configurable: true
    });
    IgrChartSummaryDescription.prototype.findByName = function (name) {
        if (this.findEphemera) {
            if (name && name.indexOf("@@e:") == 0) {
                return this.findEphemera(name);
            }
        }
        return null;
    };
    IgrChartSummaryDescription.prototype.equals = function (other) {
        var iv = this.i.equals(other);
        return (iv);
    };
    Object.defineProperty(IgrChartSummaryDescription.prototype, "provideCalculator", {
        /**
         * Called when the summary calculator is required.
        */
        get: function () {
            return this._provideCalculator;
        },
        set: function (ev) {
            var _this = this;
            if (this._provideCalculator_wrapped !== null) {
                this.i.provideCalculator = delegateRemove(this.i.provideCalculator, this._provideCalculator_wrapped);
                this._provideCalculator_wrapped = null;
                this._provideCalculator = null;
            }
            this._provideCalculator = ev;
            this._provideCalculator_wrapped = function (o, e) {
                var outerArgs = new IgrProvideCalculatorEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeProvideCalculator) {
                    _this.beforeProvideCalculator(_this, outerArgs);
                }
                if (_this._provideCalculator) {
                    _this._provideCalculator(_this, outerArgs);
                }
            };
            this.i.provideCalculator = delegateCombine(this.i.provideCalculator, this._provideCalculator_wrapped);
            ;
        },
        enumerable: false,
        configurable: true
    });
    return IgrChartSummaryDescription;
}());
export { IgrChartSummaryDescription };
