import { EventEmitter, ɵɵdirectiveInject, ChangeDetectorRef, ɵɵdefineComponent, ɵɵelementStart, ɵɵlistener, ɵɵelementEnd, ɵɵproperty, ɵsetClassMetadata, Component, Output, Input, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AlertController, LoadingController, IonicModule } from '@ionic/angular';
import { MODBUS_SETTINGS_FIELDS, TapProtocolConfigurationFormComponent, TapProtocolConfigurationModule } from '@iotize/ionic/target/common';

class TapModbusConfigurationFormComponent {
    constructor(alertCtrl, loadingCtrl, changeDetector) {
        this.alertCtrl = alertCtrl;
        this.loadingCtrl = loadingCtrl;
        this.changeDetector = changeDetector;
        this.SERIAL_SETTINGS_FIELDS = MODBUS_SETTINGS_FIELDS;
        this.valueChanges = new EventEmitter();
    }
    set values(obs) {
        var _a;
        (_a = this.valueSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
        this.valueSub = obs === null || obs === void 0 ? void 0 : obs.subscribe((newValue) => {
            this.formValues = newValue;
        });
    }
    onSerialSettingsChanged(event) {
        console.log('Onsettings changed', event);
        this.valueChanges.emit(event);
    }
}
/** @nocollapse */ TapModbusConfigurationFormComponent.ɵfac = function TapModbusConfigurationFormComponent_Factory(t) { return new (t || TapModbusConfigurationFormComponent)(ɵɵdirectiveInject(AlertController), ɵɵdirectiveInject(LoadingController), ɵɵdirectiveInject(ChangeDetectorRef)); };
/** @nocollapse */ TapModbusConfigurationFormComponent.ɵcmp = ɵɵdefineComponent({ type: TapModbusConfigurationFormComponent, selectors: [["tap-modbus-configuration-form"]], inputs: { values: "values" }, outputs: { valueChanges: "valueChanges" }, decls: 1, vars: 2, consts: [[3, "values", "fields", "valueChanges"]], template: function TapModbusConfigurationFormComponent_Template(rf, ctx) { if (rf & 1) {
        ɵɵelementStart(0, "tap-protocol-configuration-form", 0);
        ɵɵlistener("valueChanges", function TapModbusConfigurationFormComponent_Template_tap_protocol_configuration_form_valueChanges_0_listener($event) { return ctx.onSerialSettingsChanged($event); });
        ɵɵelementEnd();
    } if (rf & 2) {
        ɵɵproperty("values", ctx.formValues)("fields", ctx.SERIAL_SETTINGS_FIELDS);
    } }, directives: [TapProtocolConfigurationFormComponent], styles: ["ion-input[_ngcontent-%COMP%]{text-align:right}"] });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵsetClassMetadata(TapModbusConfigurationFormComponent, [{
        type: Component,
        args: [{
                selector: 'tap-modbus-configuration-form',
                templateUrl: './tap-modbus-configuration-form.component.html',
                styleUrls: ['./tap-modbus-configuration-form.component.scss'],
            }]
    }], function () { return [{ type: AlertController }, { type: LoadingController }, { type: ChangeDetectorRef }]; }, { valueChanges: [{
            type: Output
        }], values: [{
            type: Input
        }] }); })();

class TapTargetModbusModule {
}
/** @nocollapse */ TapTargetModbusModule.ɵfac = function TapTargetModbusModule_Factory(t) { return new (t || TapTargetModbusModule)(); };
/** @nocollapse */ TapTargetModbusModule.ɵmod = ɵɵdefineNgModule({ type: TapTargetModbusModule });
/** @nocollapse */ TapTargetModbusModule.ɵinj = ɵɵdefineInjector({ imports: [[
            IonicModule,
            FormsModule,
            ReactiveFormsModule,
            TapProtocolConfigurationModule,
        ]] });
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(TapTargetModbusModule, { declarations: [TapModbusConfigurationFormComponent], imports: [IonicModule,
        FormsModule,
        ReactiveFormsModule,
        TapProtocolConfigurationModule], exports: [TapModbusConfigurationFormComponent] }); })();
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵsetClassMetadata(TapTargetModbusModule, [{
        type: NgModule,
        args: [{
                declarations: [TapModbusConfigurationFormComponent],
                exports: [TapModbusConfigurationFormComponent],
                imports: [
                    IonicModule,
                    FormsModule,
                    ReactiveFormsModule,
                    TapProtocolConfigurationModule,
                ],
            }]
    }], null, null); })();

/**
 * Generated bundle index. Do not edit.
 */

export { TapModbusConfigurationFormComponent, TapTargetModbusModule };
//# sourceMappingURL=iotize-ionic-target-modbus.js.map
