var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { AbstractFieldWriteComponent } from '../base-field/abstract-field-write.component';
import { YesNoService } from './yes-no.service';
var WriteYesNoFieldComponent = /** @class */ (function (_super) {
    __extends(WriteYesNoFieldComponent, _super);
    function WriteYesNoFieldComponent(yesNoService) {
        var _this = _super.call(this) || this;
        _this.yesNoService = yesNoService;
        _this.yesNoValues = ['Yes', 'No'];
        return _this;
    }
    WriteYesNoFieldComponent.prototype.ngOnInit = function () {
        this.yesNoControl = this.registerControl(new FormControl(this.yesNoService.format(this.caseField.value)));
    };
    WriteYesNoFieldComponent = __decorate([
        Component({
            selector: 'ccd-write-yes-no-field',
            template: "\n    <div [id]=\"id()\" [ngClass]=\"{'form-group-error': !yesNoControl.valid && yesNoControl.touched}\">\n\n    \t<fieldset class=\"inline\">\n\n        <legend>\n          <span class=\"form-label\" *ngIf=\"caseField.label\">{{caseField | ccdFieldLabel}}</span>\n          <span class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text}}</span>\n          <span class=\"error-message\" *ngIf=\"yesNoControl.errors && yesNoControl.touched\">{{yesNoControl.errors | ccdFirstError}}</span>\n        </legend>\n\n        <div class=\"form-group bottom-30\" [id]=\"id()\">\n\n      \t  <div class=\"multiple-choice\" *ngFor=\"let value of yesNoValues\" [ngClass]=\"{selected: yesNoControl.value === value}\">\n      \t    <input class=\"form-control\" [id]=\"id()+'-'+value\" [attr.name]=\"id()\" [name]=\"id()\" type=\"radio\" [formControl]=\"yesNoControl\" [value]=\"value\">\n      \t    <label class=\"form-label\" [for]=\"id()+'-'+value\">{{value}}</label>\n      \t  </div>\n\n        </div>\n\n    \t</fieldset>\n\n    </div>\n  "
        }),
        __metadata("design:paramtypes", [YesNoService])
    ], WriteYesNoFieldComponent);
    return WriteYesNoFieldComponent;
}(AbstractFieldWriteComponent));
export { WriteYesNoFieldComponent };
//# sourceMappingURL=write-yes-no-field.component.js.map