import * as tslib_1 from "tslib";
var IgxCustomIndicatorComponent_1;
import { EventEmitter, Output, Component, forwardRef, ChangeDetectionStrategy } from '@angular/core';
import { IgxStrategyBasedIndicatorComponent } from './igx-strategy-based-indicator-component';
import { IgxFinancialIndicatorComponent } from './igx-financial-indicator-component';
import { IgxFinancialSeriesComponent } from './igx-financial-series-component';
import { IgxSeriesComponent } from './igx-series-component';
import { CustomIndicator } from "./CustomIndicator";
import { FinancialEventArgs } from "./igx-financial-event-args";
import { delegateCombine } from "igniteui-angular-core/ES2015/type";
export const IgxCustomIndicatorComponent_PROVIDERS = [{ provide: IgxStrategyBasedIndicatorComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }, { provide: IgxFinancialIndicatorComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }, { provide: IgxFinancialSeriesComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent) }];
/**
 * Represents a IgxDataChartComponent Custom Indicator series.
 * The indicator value is calculated in the user specified Indicator event handler.
*/
let IgxCustomIndicatorComponent = IgxCustomIndicatorComponent_1 = class IgxCustomIndicatorComponent extends IgxStrategyBasedIndicatorComponent {
    constructor() {
        super();
        this._indicator = null;
        this._basedOnColumns = null;
    }
    createImplementation() {
        return new CustomIndicator();
    }
    get i() {
        return this._implementation;
    }
    /**
     * This event is raised when the indicator values need to be computed.
    */
    get indicator() {
        if (this._indicator == null) {
            this._indicator = new EventEmitter();
            this.i.indicator = delegateCombine(this.i.indicator, (o, e) => {
                let outerArgs = new FinancialEventArgs();
                outerArgs._provideImplementation(e);
                this._indicator.emit({
                    sender: this,
                    args: outerArgs
                });
            });
        }
        return this._indicator;
    }
    /**
     * This event is raised when the based on columns to be specified.
    */
    get basedOnColumns() {
        if (this._basedOnColumns == null) {
            this._basedOnColumns = new EventEmitter();
            this.i.basedOnColumns = delegateCombine(this.i.indicator, (o, e) => {
                let outerArgs = new FinancialEventArgs();
                outerArgs._provideImplementation(e);
                this._basedOnColumns.emit({
                    sender: this,
                    args: outerArgs
                });
            });
        }
        return this._indicator;
    }
};
tslib_1.__decorate([
    Output(),
    tslib_1.__metadata("design:type", EventEmitter),
    tslib_1.__metadata("design:paramtypes", [])
], IgxCustomIndicatorComponent.prototype, "indicator", null);
tslib_1.__decorate([
    Output(),
    tslib_1.__metadata("design:type", EventEmitter),
    tslib_1.__metadata("design:paramtypes", [])
], IgxCustomIndicatorComponent.prototype, "basedOnColumns", null);
IgxCustomIndicatorComponent = IgxCustomIndicatorComponent_1 = tslib_1.__decorate([
    Component({
        selector: 'igx-custom-indicator',
        template: ``,
        providers: [{ provide: IgxStrategyBasedIndicatorComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent_1) }, { provide: IgxFinancialIndicatorComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent_1) }, { provide: IgxFinancialSeriesComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent_1) }, { provide: IgxSeriesComponent, useExisting: forwardRef(() => IgxCustomIndicatorComponent_1) }],
        changeDetection: ChangeDetectionStrategy.OnPush
    }),
    tslib_1.__metadata("design:paramtypes", [])
], IgxCustomIndicatorComponent);
export { IgxCustomIndicatorComponent };
//# sourceMappingURL=igx-custom-indicator-component.js.map