import { Component, Input } from '@angular/core';
import { NgForm, ControlContainer } from '@angular/forms';
import * as i0 from "@angular/core";
import * as i1 from "@c8y/ngx-components";
import * as i2 from "@angular/common";
import * as i3 from "@angular/forms";
import * as i4 from "ngx-bootstrap/buttons";
export class OpcuaDeviceProtocolDescription {
    constructor() {
        this.moId = '';
    }
    set model(_model) {
        this.moId = _model.referencedServerId;
        this._model = _model;
        this.autoScan = _model.enabled ? '1' : '0';
    }
    setAutoScanOption(data) {
        this._model.enabled = data !== '0' ? true : false;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OpcuaDeviceProtocolDescription, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: OpcuaDeviceProtocolDescription, selector: "opcua-device-protocol-description", inputs: { model: "model" }, ngImport: i0, template: "<div class=\"card-block bg-level-1 flex-no-shrink p-t-24 p-b-24\">\n  <div class=\"content-flex-70\">\n    <div class=\"text-center\">\n      <i class=\"c8y-icon-duocolor icon-48 c8y-icon c8y-icon-device-protocols\"></i>\n      <p>\n        <small class=\"label label-info\">{{ _model.fieldbusType }}</small>\n      </p>\n    </div>\n    <div class=\"flex-grow col-10\">\n      <div class=\"content-flex-80\">\n        <div class=\"col-9\">\n          <div class=\"form-group form-group-lg m-b-0\">\n            <label class=\"sr-only\" translate>Name</label>\n            <label class=\"editable\" [ngClass]=\"{ updated: ctrlName.dirty }\">\n              <input\n                type=\"text\"\n                class=\"form-control\"\n                name=\"name\"\n                #ctrlName=\"ngModel\"\n                [(ngModel)]=\"_model.name\"\n                style=\"max-width:calc( {{ _model.name.length || 10 }} * 1ch + 14px)\"\n              />\n            </label>\n          </div>\n          <div class=\"form-group\">\n            <label class=\"sr-only\" translate>Description</label>\n            <label class=\"editable\" [ngClass]=\"{ updated: ctrlDescription.dirty }\">\n              <textarea\n                class=\"form-control\"\n                rows=\"1\"\n                name=\"description\"\n                placeholder=\"{{ 'e.g. My protocol description' | translate }}\"\n                #ctrlDescription=\"ngModel\"\n                [(ngModel)]=\"_model.description\"\n                style=\"max-width:calc( {{ _model.description?.length || 25 }} * 1ch + 14px)\"\n              ></textarea>\n              <span *ngIf=\"_model.description\">\n                {{ _model.description }}\n              </span>\n            </label>\n          </div>\n          <div class=\"d-flex\">\n            <div>\n              <button\n                type=\"button\"\n                class=\"btn\"\n                name=\"autoScanAddressSpace\"\n                [(ngModel)]=\"autoScan\"\n                (ngModelChange)=\"setAutoScanOption($event)\"\n                btnCheckbox\n                btnCheckboxTrue=\"1\"\n                btnCheckboxFalse=\"0\"\n                ngDefaultControl\n              >\n                <i *ngIf=\"autoScan === '1'\" c8yIcon=\"check\" class=\"text-success\"></i>\n                <span *ngIf=\"autoScan === '1'\">\n                  {{ 'Active`auto scanning`' | translate }}\n                </span>\n\n                <i *ngIf=\"autoScan === '0'\" c8yIcon=\"ban\" class=\"text-danger\"></i>\n                <span *ngIf=\"autoScan === '0'\">\n                  {{ 'Inactive`auto scanning`' | translate }}\n                </span>\n              </button>\n            </div>\n            <small class=\"m-l-16 text-muted\">\n              {{\n                'When active, the gateway scans the address space of all servers and automatically applies this device protocol to all nodes matching the criteria.'\n                  | translate\n              }}\n            </small>\n          </div>\n        </div>\n        <div class=\"flex-grow\">\n          <ul class=\"list-unstyled small\">\n            <li class=\"p-t-4 p-b-4 d-flex separator-bottom text-nowrap\">\n              <label class=\"small m-b-0 m-r-8\" translate>ID</label>\n              <span class=\"m-l-auto\">{{ _model.id }}</span>\n            </li>\n            <li class=\"p-t-4 p-b-4 d-flex separator-bottom text-nowrap\">\n              <label class=\"small m-b-0 m-r-8\" translate>Date created</label>\n              <span class=\"m-l-auto\">{{ _model.creationTime | c8yDate }}</span>\n            </li>\n            <li class=\"p-t-4 p-b-4 d-flex separator-bottom text-nowrap\">\n              <label class=\"small m-b-0 m-r-8\" translate>Last update</label>\n              <span class=\"m-l-auto\">{{ _model.lastUpdated | c8yDate }}</span>\n            </li>\n            <li class=\"p-t-4 p-b-4 d-flex separator-bottom text-nowrap\">\n              <label class=\"small m-b-0 m-r-8\" translate>Fieldbus version</label>\n              <span class=\"m-l-auto\">{{ _model.fieldbusVersion }}</span>\n            </li>\n          </ul>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i1.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4.ButtonCheckboxDirective, selector: "[btnCheckbox]", inputs: ["btnCheckboxTrue", "btnCheckboxFalse"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i1.DatePipe, name: "c8yDate" }], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: OpcuaDeviceProtocolDescription, decorators: [{
            type: Component,
            args: [{ selector: 'opcua-device-protocol-description', viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], template: "<div class=\"card-block bg-level-1 flex-no-shrink p-t-24 p-b-24\">\n  <div class=\"content-flex-70\">\n    <div class=\"text-center\">\n      <i class=\"c8y-icon-duocolor icon-48 c8y-icon c8y-icon-device-protocols\"></i>\n      <p>\n        <small class=\"label label-info\">{{ _model.fieldbusType }}</small>\n      </p>\n    </div>\n    <div class=\"flex-grow col-10\">\n      <div class=\"content-flex-80\">\n        <div class=\"col-9\">\n          <div class=\"form-group form-group-lg m-b-0\">\n            <label class=\"sr-only\" translate>Name</label>\n            <label class=\"editable\" [ngClass]=\"{ updated: ctrlName.dirty }\">\n              <input\n                type=\"text\"\n                class=\"form-control\"\n                name=\"name\"\n                #ctrlName=\"ngModel\"\n                [(ngModel)]=\"_model.name\"\n                style=\"max-width:calc( {{ _model.name.length || 10 }} * 1ch + 14px)\"\n              />\n            </label>\n          </div>\n          <div class=\"form-group\">\n            <label class=\"sr-only\" translate>Description</label>\n            <label class=\"editable\" [ngClass]=\"{ updated: ctrlDescription.dirty }\">\n              <textarea\n                class=\"form-control\"\n                rows=\"1\"\n                name=\"description\"\n                placeholder=\"{{ 'e.g. My protocol description' | translate }}\"\n                #ctrlDescription=\"ngModel\"\n                [(ngModel)]=\"_model.description\"\n                style=\"max-width:calc( {{ _model.description?.length || 25 }} * 1ch + 14px)\"\n              ></textarea>\n              <span *ngIf=\"_model.description\">\n                {{ _model.description }}\n              </span>\n            </label>\n          </div>\n          <div class=\"d-flex\">\n            <div>\n              <button\n                type=\"button\"\n                class=\"btn\"\n                name=\"autoScanAddressSpace\"\n                [(ngModel)]=\"autoScan\"\n                (ngModelChange)=\"setAutoScanOption($event)\"\n                btnCheckbox\n                btnCheckboxTrue=\"1\"\n                btnCheckboxFalse=\"0\"\n                ngDefaultControl\n              >\n                <i *ngIf=\"autoScan === '1'\" c8yIcon=\"check\" class=\"text-success\"></i>\n                <span *ngIf=\"autoScan === '1'\">\n                  {{ 'Active`auto scanning`' | translate }}\n                </span>\n\n                <i *ngIf=\"autoScan === '0'\" c8yIcon=\"ban\" class=\"text-danger\"></i>\n                <span *ngIf=\"autoScan === '0'\">\n                  {{ 'Inactive`auto scanning`' | translate }}\n                </span>\n              </button>\n            </div>\n            <small class=\"m-l-16 text-muted\">\n              {{\n                'When active, the gateway scans the address space of all servers and automatically applies this device protocol to all nodes matching the criteria.'\n                  | translate\n              }}\n            </small>\n          </div>\n        </div>\n        <div class=\"flex-grow\">\n          <ul class=\"list-unstyled small\">\n            <li class=\"p-t-4 p-b-4 d-flex separator-bottom text-nowrap\">\n              <label class=\"small m-b-0 m-r-8\" translate>ID</label>\n              <span class=\"m-l-auto\">{{ _model.id }}</span>\n            </li>\n            <li class=\"p-t-4 p-b-4 d-flex separator-bottom text-nowrap\">\n              <label class=\"small m-b-0 m-r-8\" translate>Date created</label>\n              <span class=\"m-l-auto\">{{ _model.creationTime | c8yDate }}</span>\n            </li>\n            <li class=\"p-t-4 p-b-4 d-flex separator-bottom text-nowrap\">\n              <label class=\"small m-b-0 m-r-8\" translate>Last update</label>\n              <span class=\"m-l-auto\">{{ _model.lastUpdated | c8yDate }}</span>\n            </li>\n            <li class=\"p-t-4 p-b-4 d-flex separator-bottom text-nowrap\">\n              <label class=\"small m-b-0 m-r-8\" translate>Fieldbus version</label>\n              <span class=\"m-l-auto\">{{ _model.fieldbusVersion }}</span>\n            </li>\n          </ul>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>\n" }]
        }], propDecorators: { model: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 