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 { ToastController, IonicModule } from '@ionic/angular';
import { SERIAL_SETTINGS_FIELDS, TapProtocolConfigurationFormComponent, TapProtocolConfigurationModule } from '@iotize/ionic/target/common';

class TapSerialConfigurationFormComponent {
    constructor(changeDetector, toastController) {
        this.changeDetector = changeDetector;
        this.toastController = toastController;
        this.SERIAL_SETTINGS_FIELDS = SERIAL_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('Selected', event);
        this.valueChanges.emit(event);
    }
}
/** @nocollapse */ TapSerialConfigurationFormComponent.ɵfac = function TapSerialConfigurationFormComponent_Factory(t) { return new (t || TapSerialConfigurationFormComponent)(ɵɵdirectiveInject(ChangeDetectorRef), ɵɵdirectiveInject(ToastController)); };
/** @nocollapse */ TapSerialConfigurationFormComponent.ɵcmp = ɵɵdefineComponent({ type: TapSerialConfigurationFormComponent, selectors: [["tap-serial-configuration-form"]], inputs: { values: "values" }, outputs: { valueChanges: "valueChanges" }, decls: 1, vars: 2, consts: [[3, "values", "fields", "valueChanges"]], template: function TapSerialConfigurationFormComponent_Template(rf, ctx) { if (rf & 1) {
        ɵɵelementStart(0, "tap-protocol-configuration-form", 0);
        ɵɵlistener("valueChanges", function TapSerialConfigurationFormComponent_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: [""] });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵsetClassMetadata(TapSerialConfigurationFormComponent, [{
        type: Component,
        args: [{
                selector: 'tap-serial-configuration-form',
                templateUrl: './tap-serial-configuration-form.component.html',
                styleUrls: ['./tap-serial-configuration-form.component.scss'],
            }]
    }], function () { return [{ type: ChangeDetectorRef }, { type: ToastController }]; }, { valueChanges: [{
            type: Output
        }], values: [{
            type: Input
        }] }); })();

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

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

export { TapSerialConfigurationFormComponent, TapTargetSerialModule };
//# sourceMappingURL=iotize-ionic-target-serial.js.map
