/**
 * @fileoverview added by tsickle
 * Generated from: lib/fhir/disease/allergy/add/allergy-add.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { FormGroup, Validators, FormControl } from '@angular/forms';
import { CAN_NOT_START_WITH_WHITE_SPACE } from '../../../../shared/regular-expressions/regex';
var AllergyAddComponent = /** @class */ (function () {
    function AllergyAddComponent() {
        this.callSave = new EventEmitter();
        this.callDelete = new EventEmitter();
    }
    /**
     * @return {?}
     */
    AllergyAddComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        this.reset();
    };
    /**
     * @return {?}
     */
    AllergyAddComponent.prototype.reset = /**
     * @return {?}
     */
    function () {
        this.form = this.resetForm();
    };
    /**
     * @return {?}
     */
    AllergyAddComponent.prototype.resetForm = /**
     * @return {?}
     */
    function () {
        return new FormGroup({
            code: new FormGroup({
                text: new FormControl('', Validators.compose([Validators.required, Validators.pattern((CAN_NOT_START_WITH_WHITE_SPACE))]))
            }),
            patient: new FormGroup({
                reference: new FormControl(this.patient.id)
            })
        });
    };
    /**
     * @param {?} inData
     * @return {?}
     */
    AllergyAddComponent.prototype.save = /**
     * @param {?} inData
     * @return {?}
     */
    function (inData) {
        this.callSave.emit(inData);
        this.reset();
    };
    /**
     * @param {?} id
     * @return {?}
     */
    AllergyAddComponent.prototype.delete = /**
     * @param {?} id
     * @return {?}
     */
    function (id) {
        this.callDelete.emit(id);
    };
    AllergyAddComponent.decorators = [
        { type: Component, args: [{
                    selector: 'inc-allergy-add',
                    template: "<form [formGroup]=\"form\" (ngSubmit)=\"save(form.value)\">\r\n  <ion-grid>\r\n    <ion-row>\r\n      <ion-col size=\"10\" size-md=\"10\" formGroupName=\"code\">\r\n        <ion-item>\r\n          <ion-label position=\"floating\">{{'ALLERGYINTOLERANCE' | translate}}</ion-label>\r\n          <ion-input formControlName=\"text\" type=\"text\" clearInput> </ion-input>\r\n        </ion-item>\r\n      </ion-col>\r\n      <ion-col size=\"2\" size-md=\"2\" class=\"ion-align-self-center\">\r\n        <ion-button id=\"submitBtn\" fill=\"clear\" type=\"submit\" [disabled]=\"form.invalid\">\r\n          <ion-icon slot=\"icon-only\" name=\"add-circle-outline\"></ion-icon>\r\n        </ion-button>\r\n      </ion-col>\r\n    </ion-row>\r\n    <ion-row>\r\n      <ion-col>\r\n        <ion-chip id=\"allergyChip\" outline=\"true\" *ngFor=\"let allergy of inData\">\r\n          <ion-label color=\"primary\">\r\n            {{allergy.code.text}}\r\n          </ion-label>\r\n          <ion-icon id=\"delete\" name=\"close\" (click)=\"delete(allergy.id)\"></ion-icon>\r\n        </ion-chip>\r\n      </ion-col>\r\n    </ion-row>\r\n  </ion-grid>\r\n</form>",
                    styles: [""]
                }] }
    ];
    /** @nocollapse */
    AllergyAddComponent.ctorParameters = function () { return []; };
    AllergyAddComponent.propDecorators = {
        inData: [{ type: Input }],
        patient: [{ type: Input }],
        callSave: [{ type: Output }],
        callDelete: [{ type: Output }]
    };
    return AllergyAddComponent;
}());
export { AllergyAddComponent };
if (false) {
    /** @type {?} */
    AllergyAddComponent.prototype.inData;
    /** @type {?} */
    AllergyAddComponent.prototype.patient;
    /** @type {?} */
    AllergyAddComponent.prototype.callSave;
    /** @type {?} */
    AllergyAddComponent.prototype.callDelete;
    /** @type {?} */
    AllergyAddComponent.prototype.form;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWxsZXJneS1hZGQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGluY2xvdWRlZC9pb25pYzQtaW5jbG91ZGVkLWxpYi8iLCJzb3VyY2VzIjpbImxpYi9maGlyL2Rpc2Vhc2UvYWxsZXJneS9hZGQvYWxsZXJneS1hZGQuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsT0FBTyxFQUFFLFNBQ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