/**
 * @fileoverview added by tsickle
 * Generated from: lib/fhir/device/details/components/status/device-status.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { TAJ_REGEX } from '../../../../../shared/regular-expressions/regex';
import { Component, Input, EventEmitter, Output } from '@angular/core';
import { DeviceStatusKind } from '@ahryman40k/ts-fhir-types/lib/R4';
import { FormControl, Validators, FormGroup } from '@angular/forms';
var DeviceStatusComponent = /** @class */ (function () {
    function DeviceStatusComponent() {
        this.callUpdate = new EventEmitter();
        this.deviceStKin = DeviceStatusKind;
    }
    /**
     * @return {?}
     */
    DeviceStatusComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () { this.reset(); };
    /**
     * @return {?}
     */
    DeviceStatusComponent.prototype.reset = /**
     * @return {?}
     */
    function () {
        this.statusForm = new FormGroup({
            taj: new FormControl('', [Validators.required, Validators.pattern(TAJ_REGEX)]),
            name: new FormControl(''),
            comment: new FormControl('')
        });
    };
    /**
     * @param {?} status
     * @param {?=} statusValue
     * @return {?}
     */
    DeviceStatusComponent.prototype.update = /**
     * @param {?} status
     * @param {?=} statusValue
     * @return {?}
     */
    function (status, statusValue) {
        this.callUpdate.emit({ device: this.device, statusValue: statusValue, status: status });
        this.reset();
    };
    DeviceStatusComponent.decorators = [
        { type: Component, args: [{
                    selector: 'inc-device-status',
                    template: "<ion-grid class=\"ion-no-padding\">\r\n  <ion-row>\r\n    <ion-col size=\"12\" size-md=\"6\" class=\"avatar-container\">\r\n      <ion-avatar\r\n        [ngClass]=\"{success: device.status === 'active', danger: device.status === 'unknown', warning: device.status === 'entered-in-error'}\">\r\n        <ion-text>\r\n          <b>{{device.status | deviceStatusPipe | translate}}</b>\r\n        </ion-text>\r\n      </ion-avatar>\r\n      <div *ngIf=\"device.status === 'inactive' && device.patient\">\r\n        <ion-text color=\"primary\" *ngIf=\"device.patient.display\">\r\n          <h4 class=\"ion-text-center\">\r\n            <b>{{device.patient.display}}</b>\r\n          </h4>\r\n        </ion-text>\r\n        <h6 class=\"ion-text-center\" *ngIf=\"device.patient.reference\">{{device.patient.reference}}</h6>\r\n      </div>\r\n    </ion-col>\r\n    <ion-col size=\"12\" size-md=\"6\">\r\n      <form [formGroup]=\"statusForm\" (ngSubmit)=\"update('inactive', statusForm.value)\">\r\n        <ion-list>\r\n          <ion-item [disabled]=\"device.status !== 'active'\">\r\n            <ion-label position=\"floating\">{{'TAJ' | translate}}\r\n              <span class=\"required\">*</span>\r\n            </ion-label>\r\n            <ion-input incSinController formControlName=\"taj\" id=\"taj\" type=\"text\" autofocus=\"true\" clearInput>\r\n            </ion-input>\r\n          </ion-item>\r\n          <ion-item>\r\n            <ion-label position=\"floating\">{{'COMMENT' | translate}}</ion-label>\r\n            <ion-textarea id=\"comment\" rows=\"1\" formControlName=\"comment\" autoGrow></ion-textarea>\r\n          </ion-item>\r\n          <div class=\"ion-float-end ion-margin-top\">\r\n            <ion-button fill=\"outline\" id=\"scrapped-button\" color=\"danger\" *ngIf=\"device.status !== 'unknown'\"\r\n              (click)=\"update('unknown', statusForm.value)\" class=\"ion-margin-end\">\r\n              {{'STATUS_MAKE_SCRAPPED' | translate}}\r\n            </ion-button>\r\n            <ion-button fill=\"outline\" id=\"make-error-button\" color=\"warning\"\r\n              *ngIf=\"device.status !== 'entered-in-error'\" (click)=\"update('enteredInError', statusForm.value)\"\r\n              class=\"ion-margin-end\">\r\n              {{'STATUS_MAKE_ERROR' | translate}}\r\n            </ion-button>\r\n            <ion-button fill=\"outline\" id=\"make-active-button\" color=\"success\" *ngIf=\"device.status !== 'active'\"\r\n              (click)=\"update('active', statusForm.value)\">\r\n              {{'TAKE_BACK' | translate}}\r\n            </ion-button>\r\n            <ion-button [disabled]=\"statusForm.invalid\" id=\"make-inactive-button\" *ngIf=\"device.status === 'active'\"\r\n              type=\"submit\">\r\n              {{'STATUS_MAKE_INACTIVE' | translate}}\r\n            </ion-button>\r\n          </div>\r\n        </ion-list>\r\n      </form>\r\n    </ion-col>\r\n  </ion-row>\r\n</ion-grid>",
                    styles: [".avatar-container,ion-avatar{display:flex;justify-content:center;align-items:center}.avatar-container{flex-direction:column}ion-avatar{width:100px;height:100px;border:2px solid var(--ion-color-primary)}.success{border-color:var(--ion-color-success)}.danger{border-color:var(--ion-color-danger)}.warning{border-color:var(--ion-color-warning)}.user{background-color:var(--ion-color-primary)}"]
                }] }
    ];
    /** @nocollapse */
    DeviceStatusComponent.ctorParameters = function () { return []; };
    DeviceStatusComponent.propDecorators = {
        device: [{ type: Input }],
        callUpdate: [{ type: Output }]
    };
    return DeviceStatusComponent;
}());
export { DeviceStatusComponent };
if (false) {
    /** @type {?} */
    DeviceStatusComponent.prototype.device;
    /** @type {?} */
    DeviceStatusComponent.prototype.callUpdate;
    /** @type {?} */
    DeviceStatusComponent.prototype.deviceStKin;
    /** @type {?} */
    DeviceStatusComponent.prototype.statusForm;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGV2aWNlLXN0YXR1cy5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaW5jbG91ZGVkL2lvbmljNC1pbmNsb3VkZWQtbGliLyIsInNvdXJjZXMiOlsibGliL2ZoaXIvZGV2aWNlL2RldGFpbHMvY29tcG9uZW50cy9zdGF0dXMvZGV2aWNlLXN0YXR1cy5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0saURBQWlELENBQUM7QUFDNUUsT0FBTyxFQUFFLFNBQVMsRUFBVSxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUMvRSxPQUFPLEVBQVcsZ0JBQWdCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUM3RSxPQUFPLEVBQUUsV0FBVyxFQUFFLFVBQVUsRUFBRSxTQUFT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