import * as i0 from '@angular/core';
import { EventEmitter, Component, Output, Input, NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import * as i1 from '@ionic/angular';
import { IonicModule } from '@ionic/angular';
import * as i2 from '@iotize/ionic/target/common';
import { MODBUS_SETTINGS_FIELDS, 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 */ /** @nocollapse */ TapModbusConfigurationFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: TapModbusConfigurationFormComponent, deps: [{ token: i1.AlertController }, { token: i1.LoadingController }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ /** @nocollapse */ TapModbusConfigurationFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: TapModbusConfigurationFormComponent, selector: "tap-modbus-configuration-form", inputs: { values: "values" }, outputs: { valueChanges: "valueChanges" }, ngImport: i0, template: "<tap-protocol-configuration-form\n  [values]=\"formValues\"\n  (valueChanges)=\"onSerialSettingsChanged($event)\"\n  [fields]=\"SERIAL_SETTINGS_FIELDS\"\n>\n</tap-protocol-configuration-form>\n", styles: ["ion-input{text-align:right}\n"], components: [{ type: i2.TapProtocolConfigurationFormComponent, selector: "tap-protocol-configuration-form", inputs: ["customBaudRate", "baudRates", "fields", "values"], outputs: ["valueChanges"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: TapModbusConfigurationFormComponent, decorators: [{
            type: Component,
            args: [{ selector: 'tap-modbus-configuration-form', template: "<tap-protocol-configuration-form\n  [values]=\"formValues\"\n  (valueChanges)=\"onSerialSettingsChanged($event)\"\n  [fields]=\"SERIAL_SETTINGS_FIELDS\"\n>\n</tap-protocol-configuration-form>\n", styles: ["ion-input{text-align:right}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.AlertController }, { type: i1.LoadingController }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { valueChanges: [{
                type: Output
            }], values: [{
                type: Input
            }] } });

class TapTargetModbusModule {
}
/** @nocollapse */ /** @nocollapse */ TapTargetModbusModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: TapTargetModbusModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
/** @nocollapse */ /** @nocollapse */ TapTargetModbusModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: TapTargetModbusModule, declarations: [TapModbusConfigurationFormComponent], imports: [IonicModule,
        FormsModule,
        ReactiveFormsModule,
        TapProtocolConfigurationModule], exports: [TapModbusConfigurationFormComponent] });
/** @nocollapse */ /** @nocollapse */ TapTargetModbusModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: TapTargetModbusModule, imports: [[
            IonicModule,
            FormsModule,
            ReactiveFormsModule,
            TapProtocolConfigurationModule,
        ]] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: TapTargetModbusModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [TapModbusConfigurationFormComponent],
                    exports: [TapModbusConfigurationFormComponent],
                    imports: [
                        IonicModule,
                        FormsModule,
                        ReactiveFormsModule,
                        TapProtocolConfigurationModule,
                    ],
                }]
        }] });

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

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