/**
 * @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()
    });
}
export class SeUserModalComponent {
    /**
     * @param {?} modalController
     */
    constructor(modalController) {
        this.modalController = modalController;
        this.title = 'ADD_USER';
        this.roles = ['user', 'manager'];
        this.selectedRole = 'user';
    }
    /**
     * @return {?}
     */
    ngOnInit() {
        this.form = getUserForm(this.selectedRole);
    }
    /**
     * @param {?=} data
     * @return {?}
     */
    close(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 = () => [
    { type: ModalController }
];
SeUserModalComponent.propDecorators = {
    title: [{ type: Input }],
    form: [{ type: Input }],
    roles: [{ type: Input }],
    selectedRole: [{ type: Input }]
};
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2UtdXNlci1tb2RhbC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaW5jbG91ZGVkL2lvbmljNC1pbmNsb3VkZWQtbGliLyIsInNvdXJjZXMiOlsibGliL3VzZXIvc2UtdXNlci1tb2RhbC9zZS11c2VyLW1vZGFsLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQVUsS0FBSyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pELE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUNqRCxPQUFPLEVBQUUsU0FBUyxFQUFFLFdBQVcsRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDL0UsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHdDQUF3QyxDQUFDOzs7OztBQUVyRSxNQUFNLFVBQVUsV0FBVyxDQUFDLFlBQXFCO0lBQy9DLE9BQU8sSUFBSSxTQUFTLENBQUM7O1FBRW5CLFVBQVUsRUFBRSxJQUFJLFNBQVMsQ0FBQztZQUN4QixJQUFJLFNBQVMsQ0FBQztnQkFDWixLQUFLLEVBQUUsSUFBSSxXQUFXLENBQUMsSUFBSSxFQUFFLFVBQVUsQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUM7YUFDOUQsQ0FBQztTQUNILENBQUM7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