import { __decorate, __metadata } from "tslib";
import { Component, Input } from '@angular/core';
import { ControlContainer, NgForm } from '@angular/forms';
import { memoize } from '@c8y/ngx-components';
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";
export class UserIdConfigurationComponent {
    constructor() {
        this.withHeader = true;
        this.componentId = 0;
    }
    static { this.id = 0; }
    shouldShow(field) {
        return field in this.userIdConfig;
    }
    ngOnInit() {
        this.componentId = ++UserIdConfigurationComponent.id;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: UserIdConfigurationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: UserIdConfigurationComponent, selector: "c8y-user-id-configuration", inputs: { userIdConfig: "userIdConfig", withHeader: "withHeader" }, ngImport: i0, template: "<div [ngClass]=\"withHeader ? 'p-24' : 'd-contents'\">\n  <div [ngClass]=\"withHeader ? 'row' : 'd-contents'\">\n    <div\n      class=\"col-xs-12 col-sm-3 col-md-2\"\n      *ngIf=\"withHeader\"\n    >\n      <div\n        class=\"h4 text-normal text-right text-left-xs\"\n        translate\n      >\n        User ID\n      </div>\n    </div>\n    <fieldset\n      [ngClass]=\"withHeader ? 'col-xs-12 col-sm-9 col-md-10 col-lg-9' : 'c8y-fieldset p-24'\"\n    >\n      <legend *ngIf=\"!withHeader\">\n        {{ 'User/App ID' | translate }}\n      </legend>\n\n      <div class=\"row\">\n        <div class=\"col-sm-6\">\n          <c8y-form-group *ngIf=\"userIdConfig.useConstantValue\">\n            <label\n              class=\"control-label\"\n              [for]=\"'constantValue' + componentId\"\n              translate\n            >\n              Constant value\n            </label>\n            <input\n              class=\"form-control\"\n              type=\"text\"\n              required\n              [id]=\"'constantValue' + componentId\"\n              [name]=\"'constantValue' + componentId\"\n              [(ngModel)]=\"userIdConfig.constantValue\"\n            />\n          </c8y-form-group>\n          <c8y-form-group *ngIf=\"!userIdConfig.useConstantValue\">\n            <label\n              class=\"control-label\"\n              [for]=\"'jwtField' + componentId\"\n              translate\n            >\n              JWT field\n            </label>\n            <input\n              class=\"form-control\"\n              type=\"text\"\n              required\n              [id]=\"'jwtField' + componentId\"\n              [name]=\"'jwtField' + componentId\"\n              [(ngModel)]=\"userIdConfig.jwtField\"\n              [placeholder]=\"'e.g. {{ example }}' | translate: { example: 'upn' }\"\n            />\n          </c8y-form-group>\n        </div>\n        <div class=\"col-sm-6\">\n          <div\n            class=\"form-group\"\n            *ngIf=\"shouldShow('useConstantValue')\"\n          >\n            <div\n              class=\"form-group\"\n              *ngIf=\"shouldShow('useConstantValue')\"\n            >\n              <label\n                class=\"c8y-switch m-t-24\"\n                data-cy=\"c8y-authentication--external-token-configuration-constant-value-switcher\"\n                title=\"{{ 'Use constant value' | translate }}\"\n                [for]=\"'useConstantValue' + componentId\"\n              >\n                <input\n                  type=\"checkbox\"\n                  [name]=\"'useConstantValue' + componentId\"\n                  [id]=\"'useConstantValue' + componentId\"\n                  [(ngModel)]=\"userIdConfig.useConstantValue\"\n                />\n                <span></span>\n                <span class=\"control-label\">{{ 'Use constant value' | translate }}</span>\n              </label>\n            </div>\n          </div>\n        </div>\n      </div>\n    </fieldset>\n  </div>\n</div>\n", dependencies: [{ 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.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i1.FormGroupComponent, selector: "c8y-form-group", inputs: ["hasError", "hasWarning", "hasSuccess", "novalidation", "status"] }, { kind: "directive", type: i1.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }], viewProviders: [{ provide: ControlContainer, useExisting: NgForm }] }); }
}
__decorate([
    memoize(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String]),
    __metadata("design:returntype", void 0)
], UserIdConfigurationComponent.prototype, "shouldShow", null);
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: UserIdConfigurationComponent, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-user-id-configuration', viewProviders: [{ provide: ControlContainer, useExisting: NgForm }], template: "<div [ngClass]=\"withHeader ? 'p-24' : 'd-contents'\">\n  <div [ngClass]=\"withHeader ? 'row' : 'd-contents'\">\n    <div\n      class=\"col-xs-12 col-sm-3 col-md-2\"\n      *ngIf=\"withHeader\"\n    >\n      <div\n        class=\"h4 text-normal text-right text-left-xs\"\n        translate\n      >\n        User ID\n      </div>\n    </div>\n    <fieldset\n      [ngClass]=\"withHeader ? 'col-xs-12 col-sm-9 col-md-10 col-lg-9' : 'c8y-fieldset p-24'\"\n    >\n      <legend *ngIf=\"!withHeader\">\n        {{ 'User/App ID' | translate }}\n      </legend>\n\n      <div class=\"row\">\n        <div class=\"col-sm-6\">\n          <c8y-form-group *ngIf=\"userIdConfig.useConstantValue\">\n            <label\n              class=\"control-label\"\n              [for]=\"'constantValue' + componentId\"\n              translate\n            >\n              Constant value\n            </label>\n            <input\n              class=\"form-control\"\n              type=\"text\"\n              required\n              [id]=\"'constantValue' + componentId\"\n              [name]=\"'constantValue' + componentId\"\n              [(ngModel)]=\"userIdConfig.constantValue\"\n            />\n          </c8y-form-group>\n          <c8y-form-group *ngIf=\"!userIdConfig.useConstantValue\">\n            <label\n              class=\"control-label\"\n              [for]=\"'jwtField' + componentId\"\n              translate\n            >\n              JWT field\n            </label>\n            <input\n              class=\"form-control\"\n              type=\"text\"\n              required\n              [id]=\"'jwtField' + componentId\"\n              [name]=\"'jwtField' + componentId\"\n              [(ngModel)]=\"userIdConfig.jwtField\"\n              [placeholder]=\"'e.g. {{ example }}' | translate: { example: 'upn' }\"\n            />\n          </c8y-form-group>\n        </div>\n        <div class=\"col-sm-6\">\n          <div\n            class=\"form-group\"\n            *ngIf=\"shouldShow('useConstantValue')\"\n          >\n            <div\n              class=\"form-group\"\n              *ngIf=\"shouldShow('useConstantValue')\"\n            >\n              <label\n                class=\"c8y-switch m-t-24\"\n                data-cy=\"c8y-authentication--external-token-configuration-constant-value-switcher\"\n                title=\"{{ 'Use constant value' | translate }}\"\n                [for]=\"'useConstantValue' + componentId\"\n              >\n                <input\n                  type=\"checkbox\"\n                  [name]=\"'useConstantValue' + componentId\"\n                  [id]=\"'useConstantValue' + componentId\"\n                  [(ngModel)]=\"userIdConfig.useConstantValue\"\n                />\n                <span></span>\n                <span class=\"control-label\">{{ 'Use constant value' | translate }}</span>\n              </label>\n            </div>\n          </div>\n        </div>\n      </div>\n    </fieldset>\n  </div>\n</div>\n" }]
        }], propDecorators: { userIdConfig: [{
                type: Input
            }], withHeader: [{
                type: Input
            }], shouldShow: [] } });
//# sourceMappingURL=data:application/json;base64, 