/**
 * @fileoverview added by tsickle
 * Generated from: lib/tap-monitoring-settings/tap-monitoring-settings.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { __awaiter } from "tslib";
import { Component, Input } from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { MonitoringSettingsService } from './monitoring-settings.service';
import { ModalController } from '@ionic/angular';
export class TapMonitoringSettingsComponent {
    /**
     * @param {?} formBuilder
     * @param {?} monitoringSettingsService
     * @param {?} modalController
     */
    constructor(formBuilder, monitoringSettingsService, modalController) {
        this.formBuilder = formBuilder;
        this.monitoringSettingsService = monitoringSettingsService;
        this.modalController = modalController;
        this.showDataSource = false;
        this.form = this.formBuilder.group({
            period: [this.monitoringSettingsService.settings.period],
            dataSource: ['live']
        });
    }
    /**
     * @return {?}
     */
    get period() { return (/** @type {?} */ (this.form.get('period'))); }
    /**
     * @return {?}
     */
    get dataSource() { return (/** @type {?} */ (this.form.get('dataSource'))); }
    /**
     * @return {?}
     */
    ngOnInit() {
        this.form.valueChanges.subscribe((/**
         * @param {?} newValues
         * @return {?}
         */
        (newValues) => {
            this.monitoringSettingsService.settings = {
                period: this.period.value
            };
        }));
    }
    /**
     * @return {?}
     */
    dismiss() {
        return __awaiter(this, void 0, void 0, function* () {
            /** @type {?} */
            let topOverlay = yield this.modalController.getTop();
            if (topOverlay) {
                this.modalController.dismiss(topOverlay.id);
            }
        });
    }
}
TapMonitoringSettingsComponent.decorators = [
    { type: Component, args: [{
                selector: 'lib-tap-monitoring-settings',
                template: "<ion-content>\r\n    <form [formGroup]=\"form\">\r\n        <ion-list>\r\n            <ion-list-header>\r\n                <ion-label>\r\n                    Monitoring settings\r\n                </ion-label>\r\n            </ion-list-header>\r\n            <ion-item>\r\n                <ion-label>Frequency (in milliseconds)</ion-label>\r\n                <ion-input [formControlName]=\"'period'\" slot=\"end\" text-right type=\"number\"></ion-input>\r\n            </ion-item>\r\n            <ion-item *ngIf=\"showDataSource\">\r\n                <ion-label>Data source</ion-label>\r\n                <ion-select [formControlName]=\"'dataSource'\" slot=\"end\">\r\n                    <ion-select-option value=\"live\">Live data</ion-select-option>\r\n                    <ion-select-option value=\"datalog\">Data log</ion-select-option>\r\n                </ion-select>\r\n            </ion-item>\r\n        </ion-list>\r\n    </form>\r\n</ion-content>\r\n<ion-footer>\r\n    <ion-toolbar>\r\n        <ion-buttons slot=\"end\">\r\n            <ion-button (click)=\"dismiss()\">Ok</ion-button>\r\n        </ion-buttons>\r\n    </ion-toolbar>\r\n</ion-footer>\r\n",
                styles: [""]
            }] }
];
/** @nocollapse */
TapMonitoringSettingsComponent.ctorParameters = () => [
    { type: FormBuilder },
    { type: MonitoringSettingsService },
    { type: ModalController }
];
TapMonitoringSettingsComponent.propDecorators = {
    showDataSource: [{ type: Input }]
};
if (false) {
    /** @type {?} */
    TapMonitoringSettingsComponent.prototype.showDataSource;
    /** @type {?} */
    TapMonitoringSettingsComponent.prototype.form;
    /** @type {?} */
    TapMonitoringSettingsComponent.prototype.formBuilder;
    /** @type {?} */
    TapMonitoringSettingsComponent.prototype.monitoringSettingsService;
    /** @type {?} */
    TapMonitoringSettingsComponent.prototype.modalController;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFwLW1vbml0b3Jpbmctc2V0dGluZ3MuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGlvdGl6ZS9pb25pYy9tb25pdG9yaW5nLyIsInNvdXJjZXMiOlsibGliL3RhcC1tb25pdG9yaW5nLXNldHRpbmdzL3RhcC1tb25pdG9yaW5nLXNldHRpbmdzLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFVLEtBQUssRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN6RCxPQUFPLEVBQUUsV0FBVyxFQUFhLE1BQU0sZ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