/**
 * @fileoverview added by tsickle
 * Generated from: lib/fhir/observation/observation-definiton/details/observation-definition-details.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Component, Output, EventEmitter } from '@angular/core';
import { AbstractDetailsComponent } from '../../../../shared/abstracts/details/abstract-details/abstract-details.component';
import { ActionSheetController } from '@ionic/angular';
import { TranslatePipe } from '../../../../shared/translate/pipes/translate.pipe';
import { stringToDefinitionView } from '../../../functions/observation-definition.function';
/** @type {?} */
const CUSTOM_COLS = [
    { name: 'CUSTOM_ALERTS', colSize: 3 },
    { name: 'Minimum', colSize: 3 },
    { name: 'Maximum', colSize: 5.3 }
];
/** @type {?} */
const TIME_SERIES_COLS = [
    { name: 'TIME_SERIES_ALERTS', colSize: 3 },
    { name: 'SCHEDULE', colSize: 3 },
    { name: 'OPERATION', colSize: 3 },
    { name: 'ALERT', colSize: 2.3 }
];
export class ObservationDefinitionDetailsComponent extends AbstractDetailsComponent {
    /**
     * @param {?} actionSheetController
     * @param {?} translatePipe
     */
    constructor(actionSheetController, translatePipe) {
        super();
        this.actionSheetController = actionSheetController;
        this.translatePipe = translatePipe;
        this.callDelete = new EventEmitter();
        this.callUpdate = new EventEmitter();
        this.customCols = CUSTOM_COLS;
        this.timeSeriesCols = TIME_SERIES_COLS;
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        this.setDefinitionView();
    }
    /**
     * @return {?}
     */
    setDefinitionView() {
        this.definitionView = stringToDefinitionView(this.inData, this.translatePipe);
    }
    /**
     * @param {?} data
     * @return {?}
     */
    delete(data) {
        this.callDelete.emit(data);
    }
    /**
     * @param {?} data
     * @param {?} modalType
     * @return {?}
     */
    update(data, modalType) {
        this.callUpdate.emit({ data, modalType });
    }
    /**
     * @param {?} reference
     * @param {?} modalType
     * @return {?}
     */
    openActionSheet(reference, modalType) {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            /** @type {?} */
            const actionSheet = yield this.actionSheetController.create({
                buttons: [{
                        text: this.translatePipe.transform('EDIT_L'),
                        icon: 'create',
                        handler: (/**
                         * @return {?}
                         */
                        () => { this.update(this.inData.filter((/**
                         * @param {?} data
                         * @return {?}
                         */
                        data => data.reference === reference))[0], modalType); })
                    },
                    {
                        text: this.translatePipe.transform('DELETE_L'),
                        icon: 'trash',
                        handler: (/**
                         * @return {?}
                         */
                        () => { this.delete(this.inData.filter((/**
                         * @param {?} data
                         * @return {?}
                         */
                        data => data.reference === reference))[0]); })
                    }]
            });
            yield actionSheet.present();
        });
    }
}
ObservationDefinitionDetailsComponent.decorators = [
    { type: Component, args: [{
                selector: 'inc-observation-definition-details',
                template: "<ion-grid class=\"ion-no-padding\">\r\n  <ng-container *ngIf=\"definitionView.custom && definitionView.custom[0]\">\r\n    <ion-row class=\"title\">\r\n      <ion-col *ngFor=\"let customCol of customCols; let i = index\" [size]=\"customCol.colSize\">\r\n        <ion-text>{{i === 2 && definitionView.custom[0].values[2] === undefined ? '' : customCol.name | translate}}</ion-text>\r\n      </ion-col>\r\n    </ion-row>\r\n    <ion-row class=\"row-data\" *ngFor=\"let custom of definitionView.custom\" (click)=\"openActionSheet(custom.reference, 'atomic')\">\r\n      <ion-col *ngFor=\"let customCol of customCols; let i = index\" [size]=\"customCol.colSize\">\r\n        <ion-text>{{custom.values[i]}}</ion-text>\r\n      </ion-col>\r\n      <ion-col size=\"0.7\">\r\n        <ion-buttons>\r\n          <ion-button fill=\"clear\" size=\"small\">\r\n            <ion-icon name=\"more\"></ion-icon>\r\n          </ion-button>\r\n        </ion-buttons>\r\n      </ion-col>\r\n    </ion-row>\r\n  </ng-container>\r\n  <ng-container *ngIf=\"definitionView.timeSeries && definitionView.timeSeries[0]\">\r\n    <ion-row class=\"title\">\r\n      <ion-col *ngFor=\"let timeSeriesCol of timeSeriesCols\" [size]=\"timeSeriesCol.colSize\">\r\n        <ion-text>{{timeSeriesCol.name | translate}}</ion-text>\r\n      </ion-col>\r\n    </ion-row>\r\n    <ion-row class=\"row-data\" *ngFor=\"let timeSeries of definitionView.timeSeries\" (click)=\"openActionSheet(timeSeries.reference, 'aggregated')\">\r\n      <ion-col *ngFor=\"let timeSeriesCol of timeSeriesCols; let i = index\" [size]=\"timeSeriesCol.colSize\">\r\n        <ion-text>{{timeSeries.values[i]}}</ion-text>\r\n      </ion-col>\r\n      <ion-col size=\"0.7\">\r\n        <ion-buttons>\r\n          <ion-button fill=\"clear\" size=\"small\">\r\n            <ion-icon name=\"more\"></ion-icon>\r\n          </ion-button>\r\n        </ion-buttons>\r\n      </ion-col>\r\n    </ion-row>\r\n  </ng-container>\r\n</ion-grid>",
                styles: [".title ion-col:first-child ion-text{font-weight:700}.title ion-col{padding-top:0;padding-bottom:0}.title ion-col ion-text{word-break:break-all;display:flex;padding-top:7px;color:var(--ion-color-primary)}.row-data{cursor:pointer}.row-data ion-buttons{visibility:hidden}.row-data ion-col:first-child ion-text{font-weight:700}.row-data ion-col{padding-top:0;padding-bottom:0}.row-data ion-col ion-text{word-break:break-all;display:flex;padding-top:7px}.row-data:hover ion-buttons{visibility:visible}"]
            }] }
];
/** @nocollapse */
ObservationDefinitionDetailsComponent.ctorParameters = () => [
    { type: ActionSheetController },
    { type: TranslatePipe }
];
ObservationDefinitionDetailsComponent.propDecorators = {
    callDelete: [{ type: Output }],
    callUpdate: [{ type: Output }]
};
if (false) {
    /** @type {?} */
    ObservationDefinitionDetailsComponent.prototype.callDelete;
    /** @type {?} */
    ObservationDefinitionDetailsComponent.prototype.callUpdate;
    /** @type {?} */
    ObservationDefinitionDetailsComponent.prototype.customCols;
    /** @type {?} */
    ObservationDefinitionDetailsComponent.prototype.timeSeriesCols;
    /** @type {?} */
    ObservationDefinitionDetailsComponent.prototype.definitionView;
    /**
     * @type {?}
     * @private
     */
    ObservationDefinitionDetailsComponent.prototype.actionSheetController;
    /**
     * @type {?}
     * @private
     */
    ObservationDefinitionDetailsComponent.prototype.translatePipe;
}
//# sourceMappingURL=data:application/json;base64, 