/**
 * @fileoverview added by tsickle
 * Generated from: lib/user/se-user-modal/se-user-modal.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, Input } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { FormGroup, FormControl, FormArray, Validators } from '@angular/forms';
import { EMAIL_REGEX } from '../../shared/regular-expressions/regex';
/**
 * @param {?=} selectedRole
 * @return {?}
 */
export function getUserForm(selectedRole) {
    return new FormGroup({
        // email
        identifier: new FormArray([
            new FormGroup({
                value: new FormControl(null, Validators.pattern(EMAIL_REGEX))
            })
        ]),
        // role
        code: new FormArray([
            new FormGroup({
                coding: new FormArray([
                    new FormGroup({
                        code: new FormControl(selectedRole),
                        display: new FormControl()
                    })
                ])
            })
        ]),
        password: new FormControl()
    });
}
var SeUserModalComponent = /** @class */ (function () {
    function SeUserModalComponent(modalController) {
        this.modalController = modalController;
        this.title = 'ADD_USER';
        this.roles = ['user', 'manager'];
        this.selectedRole = 'user';
    }
    /**
     * @return {?}
     */
    SeUserModalComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        this.form = getUserForm(this.selectedRole);
    };
    /**
     * @param {?=} data
     * @return {?}
     */
    SeUserModalComponent.prototype.close = /**
     * @param {?=} data
     * @return {?}
     */
    function (data) {
        this.modalController.dismiss(data);
    };
    SeUserModalComponent.decorators = [
        { type: Component, args: [{
                    selector: 'inc-se-user-modal',
                    template: "<ion-header>\r\n  <ion-toolbar color=\"light\">\r\n    <ion-title>{{title | translate}}</ion-title>\r\n    <ion-buttons slot=\"end\">\r\n      <ion-button (click)=\"close()\">\r\n        <ion-icon slot=\"icon-only\" name=\"close\"></ion-icon>\r\n      </ion-button>\r\n    </ion-buttons>\r\n  </ion-toolbar>\r\n</ion-header>\r\n\r\n<ion-content style=\"--background: var(--ion-item-background);\">\r\n  <form [formGroup]=\"form\">\r\n    <ion-grid class=\"ion-padding\">\r\n      <ion-row>\r\n        <ion-col size=\"12\" size-sm=\"6\" formArrayName=\"identifier\">\r\n          <ion-item formGroupName=\"0\">\r\n            <ion-label position=\"floating\">{{'EMAIL' | translate}}\r\n              <span class=\"required\">*</span>\r\n            </ion-label>\r\n            <ion-input type=\"email\" clearInput formControlName=\"value\" required autocomplete=\"off\">\r\n            </ion-input>\r\n          </ion-item>\r\n        </ion-col>\r\n        <ion-col size=\"12\" size-sm=\"6\">\r\n          <ion-item>\r\n            <ion-label position=\"floating\">{{'PASSWORD' | translate}}\r\n              <span class=\"required\">*</span>\r\n            </ion-label>\r\n            <ion-input minlength=\"6\" formControlName=\"password\" clearInput required autocomplete=\"off\">\r\n            </ion-input>\r\n          </ion-item>\r\n        </ion-col>\r\n      </ion-row>\r\n      <ion-row formArrayName=\"code\">\r\n        <ion-col size=\"12\" formGroupName=\"0\">\r\n          <span formArrayName=\"coding\">\r\n            <span formGroupName=\"0\">\r\n              <ion-radio-group class=\"radio-hor\" formControlName=\"code\">\r\n                <ion-item *ngFor=\"let role of roles\" lines=\"none\">\r\n                  <ion-label>{{role | uppercase | translate}}</ion-label>\r\n                  <ion-radio slot=\"start\" mode=\"md\" [value]=\"role\" color=\"secondary\"></ion-radio>\r\n                </ion-item>\r\n              </ion-radio-group>\r\n            </span>\r\n          </span>\r\n        </ion-col>\r\n      </ion-row>\r\n      <ion-row class=\"ion-float-right ion-margin-top\">\r\n        <ion-button fill=\"outline\" color=\"primary\" id=\"cancelBtn\" class=\"ion-margin-end\" (click)=\"close()\">\r\n          {{'CANCEL' | translate}}\r\n        </ion-button>\r\n        <ion-button id=\"submitBtn\" [disabled]=\"form.invalid || form.pristine\" (click)=\"close(form.value)\">\r\n          <ion-icon slot=\"start\" name=\"save\"></ion-icon>{{'SAVE' | translate}}\r\n        </ion-button>\r\n      </ion-row>\r\n    </ion-grid>\r\n  </form>\r\n</ion-content>",
                    styles: ["@media (min-width:768px){.radio-hor{display:flex;flex-direction:row}.radio-hor ion-item{flex:1}}"]
                }] }
    ];
    /** @nocollapse */
    SeUserModalComponent.ctorParameters = function () { return [
        { type: ModalController }
    ]; };
    SeUserModalComponent.propDecorators = {
        title: [{ type: Input }],
        form: [{ type: Input }],
        roles: [{ type: Input }],
        selectedRole: [{ type: Input }]
    };
    return SeUserModalComponent;
}());
export { SeUserModalComponent };
if (false) {
    /** @type {?} */
    SeUserModalComponent.prototype.title;
    /** @type {?} */
    SeUserModalComponent.prototype.form;
    /** @type {?} */
    SeUserModalComponent.prototype.roles;
    /** @type {?} */
    SeUserModalComponent.prototype.selectedRole;
    /**
     * @type {?}
     * @private
     */
    SeUserModalComponent.prototype.modalController;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2UtdXNlci1tb2RhbC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaW5jbG91ZGVkL2lvbmljNC1pbmNsb3VkZWQtbGliLyIsInNvdXJjZXMiOlsibGliL3VzZXIvc2UtdXNlci1tb2RhbC9zZS11c2VyLW1vZGFsLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQVUsS0FBSyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pELE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUNqRCxPQUFPLEVBQUUsU0FBUyxFQUFFLFdBQVcsRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDL0UsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHdDQUF3QyxDQUFDOzs7OztBQUVyRSxNQUFNLFVBQVUsV0FBVyxDQUFDLFlBQXFCO0lBQy9DLE9BQU8sSUFBSSxTQUFTLENBQUM7O1FBRW5CLFVBQVUsRUFBRSxJQUFJLFNBQVMsQ0FBQztZQUN4QixJQUFJLFNBQVMsQ0FBQztnQkFDWixLQUF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