import { __decorate } from "tslib";
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { ItemService } from '../item-service/item-service.service';
import { QuizService } from '../../../shared/service/quiz.service';
let ItemTypeWrapperComponent = class ItemTypeWrapperComponent {
    constructor(itemService, quizService) {
        this.itemService = itemService;
        this.quizService = quizService;
        this.userAnswerObj = [];
        this.imagePath = [];
        this.userAnswerValue = new EventEmitter();
        this.figureLabelEntry = new EventEmitter();
    }
    set testData(value) {
        this.preferredTextFormat = value.preferredTextFormat;
    }
    ngOnInit() {
        this.userAnswerObj = [];
        this.itemService.currentState.subscribe(message => (this.message = message));
        this.itemService.currentAnswerState.subscribe(clear => (this.clearAnswer = clear));
        this.itemService.userAnswerState.subscribe(answer => (this.userAnswerService = answer));
        this.itemService.validateAnswerValueState.subscribe(correct => (this.isCorrect = correct));
        this.itemService.duplicateValueState.subscribe(duplicate => (this.duplicalteValue = duplicate));
        this.itemService.validateCompleteEntryState.subscribe(entry => (this.completeEntry = entry));
        this.instanceData = this.quizService.instanceDetails;
        this.testSettings = this.quizService.testSettings;
    }
    ngDoCheck() {
        if (this.emptyAnswer === true) {
            this.itemService.userAnswerMethod([]);
        }
        if (this.isClearAnswer === true) {
            this.itemService.userAnswerMethod([]);
            this.itemService.clearAnswerMethodFalse(false);
        }
        this.userAnswerObj = [];
        this.userAnswerObj['userAnswer'] = this.userAnswerService;
        this.userAnswerObj['correct'] = this.isCorrect;
        this.userAnswerValue.emit(this.userAnswerObj);
        this.figureLabelEntry.emit({
            duplicate: this.duplicalteValue,
            entry: this.completeEntry
        });
    }
    metadataDisplayValidation() {
        if (this.instanceData && this.questionCurrentData && this.testSettings) {
            if (this.testSettings.showMetadata &&
                this.instanceData.isPreview &&
                this.questionCurrentData.selectedMetaDetails) {
                return true;
            }
            return false;
        }
        return false;
    }
};
ItemTypeWrapperComponent.ctorParameters = () => [
    { type: ItemService },
    { type: QuizService }
];
__decorate([
    Input()
], ItemTypeWrapperComponent.prototype, "questionCurrentData", void 0);
__decorate([
    Input()
], ItemTypeWrapperComponent.prototype, "examEngineType", void 0);
__decorate([
    Input()
], ItemTypeWrapperComponent.prototype, "isClearAnswer", void 0);
__decorate([
    Input()
], ItemTypeWrapperComponent.prototype, "isShowHide", void 0);
__decorate([
    Input()
], ItemTypeWrapperComponent.prototype, "imagePath", void 0);
__decorate([
    Input()
], ItemTypeWrapperComponent.prototype, "checkQuizSubmission", void 0);
__decorate([
    Input()
], ItemTypeWrapperComponent.prototype, "emptyAnswer", void 0);
__decorate([
    Input()
], ItemTypeWrapperComponent.prototype, "selectedTheme", void 0);
__decorate([
    Input()
], ItemTypeWrapperComponent.prototype, "fontSize", void 0);
__decorate([
    Input('testData')
], ItemTypeWrapperComponent.prototype, "testData", null);
__decorate([
    Output()
], ItemTypeWrapperComponent.prototype, "userAnswerValue", void 0);
__decorate([
    Output()
], ItemTypeWrapperComponent.prototype, "figureLabelEntry", void 0);
ItemTypeWrapperComponent = __decorate([
    Component({
        selector: 'item-type-wrapper',
        template: "<ng-container *ngIf=\"questionCurrentData\">\n  <div class=\"item-wrapper-container\">\n    <!--Exhibit modal -->\n    <app-exhibit-modal\n      [fontSize]=\"fontSize\"\n      [selectedTheme]=\"selectedTheme\"\n      [questionDetails]=\"questionCurrentData\"\n      [examEngineType]=\"examEngineType\"\n    ></app-exhibit-modal>\n\n    <!--Multiple choice Question -->\n    <ng-container\n      *ngIf=\"\n        questionCurrentData &&\n        questionCurrentData.labelText == 'MULTIPLE_CHOICE' &&\n        !questionCurrentData.parentDetails\n      \"\n    >\n      <multiple-choice\n        [imagePath]=\"imagePath\"\n        [checkQuizSubmission]=\"checkQuizSubmission\"\n        [isClearAnswer]=\"isClearAnswer\"\n        [isShowHide]=\"isShowHide\"\n        [questionDetails]=\"questionCurrentData\"\n        [examEngineType]=\"examEngineType\"\n        [canShowMetadata]=\"metadataDisplayValidation()\"\n        [preferredTextFormat]=\"preferredTextFormat\"\n      ></multiple-choice>\n    </ng-container>\n\n    <!--Mulitple Response-->\n    <ng-container\n      *ngIf=\"\n        questionCurrentData.labelText == 'CHOICE_MULTIPLE' &&\n        !questionCurrentData.parentDetails\n      \"\n    >\n      <multiple-response\n        [checkQuizSubmission]=\"checkQuizSubmission\"\n        [imagePath]=\"imagePath\"\n        [isClearAnswer]=\"isClearAnswer\"\n        [isShowHide]=\"isShowHide\"\n        [questionDetails]=\"questionCurrentData\"\n        [examEngineType]=\"examEngineType\"\n        [canShowMetadata]=\"metadataDisplayValidation()\"\n        [preferredTextFormat]=\"preferredTextFormat\"\n      ></multiple-response>\n    </ng-container>\n\n    <!--Clinical Sympotoms-->\n    <ng-container\n      *ngIf=\"\n        questionCurrentData.parentDetails &&\n        questionCurrentData.parentLabelText == 'CLINICAL_SYMPTOMS'\n      \"\n    >\n      <!--Clinical-multiple-choice-->\n      <ng-container *ngIf=\"questionCurrentData.labelText == 'MULTIPLE_CHOICE'\">\n        <clinical-multiple-choice\n          [checkQuizSubmission]=\"checkQuizSubmission\"\n          [isClearAnswer]=\"isClearAnswer\"\n          [isShowHide]=\"isShowHide\"\n          [questionDetails]=\"questionCurrentData\"\n          [examEngineType]=\"examEngineType\"\n          [imagePath]=\"imagePath\"\n          [canShowMetadata]=\"metadataDisplayValidation()\"\n          [preferredTextFormat]=\"preferredTextFormat\"\n        >\n        </clinical-multiple-choice>\n      </ng-container>\n\n      <!--Clinical-multiple-response-->\n      <ng-container *ngIf=\"questionCurrentData.labelText == 'CHOICE_MULTIPLE'\">\n        <clinical-multiple-response\n          [checkQuizSubmission]=\"checkQuizSubmission\"\n          [isClearAnswer]=\"isClearAnswer\"\n          [isShowHide]=\"isShowHide\"\n          [questionDetails]=\"questionCurrentData\"\n          [examEngineType]=\"examEngineType\"\n          [imagePath]=\"imagePath\"\n          [canShowMetadata]=\"metadataDisplayValidation()\"\n          [preferredTextFormat]=\"preferredTextFormat\"\n        >\n        </clinical-multiple-response>\n      </ng-container>\n    </ng-container>\n\n    <!--Medical case-->\n    <ng-container\n      *ngIf=\"\n        questionCurrentData.parentDetails &&\n        questionCurrentData.parentLabelText == 'MEDICAL_CASE'\n      \"\n    >\n      <!--Medical Multiple choice-->\n      <ng-container *ngIf=\"questionCurrentData.labelText == 'MULTIPLE_CHOICE'\">\n        <medical-multiple-choice\n          [checkQuizSubmission]=\"checkQuizSubmission\"\n          [isClearAnswer]=\"isClearAnswer\"\n          [isShowHide]=\"isShowHide\"\n          [questionDetails]=\"questionCurrentData\"\n          [examEngineType]=\"examEngineType\"\n          [imagePath]=\"imagePath\"\n          [canShowMetadata]=\"metadataDisplayValidation()\"\n          [preferredTextFormat]=\"preferredTextFormat\"\n        >\n        </medical-multiple-choice>\n      </ng-container>\n\n      <!--Medical multiple response-->\n      <ng-container *ngIf=\"questionCurrentData.labelText == 'CHOICE_MULTIPLE'\">\n        <medical-multiple-response\n          [checkQuizSubmission]=\"checkQuizSubmission\"\n          [isClearAnswer]=\"isClearAnswer\"\n          [isShowHide]=\"isShowHide\"\n          [questionDetails]=\"questionCurrentData\"\n          [examEngineType]=\"examEngineType\"\n          [imagePath]=\"imagePath\"\n          [canShowMetadata]=\"metadataDisplayValidation()\"\n          [preferredTextFormat]=\"preferredTextFormat\"\n        >\n        </medical-multiple-response>\n      </ng-container>\n    </ng-container>\n\n    <!--True / False -->\n    <ng-container *ngIf=\"questionCurrentData.labelText == 'TRUE_FALSE'\">\n      <true-false\n        [imagePath]=\"imagePath\"\n        [checkQuizSubmission]=\"checkQuizSubmission\"\n        [isClearAnswer]=\"isClearAnswer\"\n        [isShowHide]=\"isShowHide\"\n        [questionDetails]=\"questionCurrentData\"\n        [examEngineType]=\"examEngineType\"\n        [canShowMetadata]=\"metadataDisplayValidation()\"\n        [preferredTextFormat]=\"preferredTextFormat\"\n      ></true-false>\n    </ng-container>\n\n    <!--Fill in the blanks-->\n    <ng-container *ngIf=\"questionCurrentData.labelText == 'FILL_IN_THE_BLANK'\">\n      <fill-in-the-blanks\n        [fontSize]=\"fontSize\"\n        [selectedTheme]=\"selectedTheme\"\n        [checkQuizSubmission]=\"checkQuizSubmission\"\n        [imagePath]=\"imagePath\"\n        [isClearAnswer]=\"isClearAnswer\"\n        [isShowHide]=\"isShowHide\"\n        [questionDetails]=\"questionCurrentData\"\n        [examEngineType]=\"examEngineType\"\n        [canShowMetadata]=\"metadataDisplayValidation()\"\n        [preferredTextFormat]=\"preferredTextFormat\"\n      ></fill-in-the-blanks>\n    </ng-container>\n\n    <!--Graphic option-->\n    <ng-container *ngIf=\"questionCurrentData.labelText == 'GRAPHIC_OPTION'\">\n      <graphic-option\n        [checkQuizSubmission]=\"checkQuizSubmission\"\n        [imagePath]=\"imagePath\"\n        [isClearAnswer]=\"isClearAnswer\"\n        [isShowHide]=\"isShowHide\"\n        [questionDetails]=\"questionCurrentData\"\n        [examEngineType]=\"examEngineType\"\n        [canShowMetadata]=\"metadataDisplayValidation()\"\n        [preferredTextFormat]=\"preferredTextFormat\"\n      ></graphic-option>\n    </ng-container>\n\n    <!--Drag and Drop-->\n\n    <ng-container *ngIf=\"questionCurrentData.labelText == 'DRAG_AND_DROP'\">\n      <drag-and-drop\n        [fontSize]=\"fontSize\"\n        [selectedTheme]=\"selectedTheme\"\n        [checkQuizSubmission]=\"checkQuizSubmission\"\n        [imagePath]=\"imagePath\"\n        [isClearAnswer]=\"isClearAnswer\"\n        [isShowHide]=\"isShowHide\"\n        [questionDetails]=\"questionCurrentData\"\n        [examEngineType]=\"examEngineType\"\n        [canShowMetadata]=\"metadataDisplayValidation()\"\n        [preferredTextFormat]=\"preferredTextFormat\"\n      ></drag-and-drop>\n    </ng-container>\n\n    <!--Hotspot-->\n\n    <ng-container *ngIf=\"questionCurrentData.labelText == 'HOT_SPOT'\">\n      <hot-spot\n        class=\"hotspot-focus\"\n        [fontSize]=\"fontSize\"\n        [selectedTheme]=\"selectedTheme\"\n        [checkQuizSubmission]=\"checkQuizSubmission\"\n        [imagePath]=\"imagePath\"\n        [isClearAnswer]=\"isClearAnswer\"\n        [isShowHide]=\"isShowHide\"\n        [questionDetails]=\"questionCurrentData\"\n        [examEngineType]=\"examEngineType\"\n        [canShowMetadata]=\"metadataDisplayValidation()\"\n        [preferredTextFormat]=\"preferredTextFormat\"\n      ></hot-spot>\n    </ng-container>\n\n    <!--Figure Labelling-->\n\n    <ng-container *ngIf=\"questionCurrentData.labelText == 'FIGURE_LABELING'\">\n      <figure-labeling\n        [fontSize]=\"fontSize\"\n        [selectedTheme]=\"selectedTheme\"\n        [checkQuizSubmission]=\"checkQuizSubmission\"\n        [imagePath]=\"imagePath\"\n        [isClearAnswer]=\"isClearAnswer\"\n        [isShowHide]=\"isShowHide\"\n        [questionDetails]=\"questionCurrentData\"\n        [examEngineType]=\"examEngineType\"\n        [canShowMetadata]=\"metadataDisplayValidation()\"\n        [preferredTextFormat]=\"preferredTextFormat\"\n      ></figure-labeling>\n    </ng-container>\n\n    <!--Inline choice-->\n\n    <ng-container *ngIf=\"questionCurrentData.labelText == 'INLINE_CHOICE'\">\n      <inline-choice\n        [checkQuizSubmission]=\"checkQuizSubmission\"\n        [imagePath]=\"imagePath\"\n        [isClearAnswer]=\"isClearAnswer\"\n        [isShowHide]=\"isShowHide\"\n        [questionDetails]=\"questionCurrentData\"\n        [examEngineType]=\"examEngineType\"\n        [canShowMetadata]=\"metadataDisplayValidation()\"\n        [preferredTextFormat]=\"preferredTextFormat\"\n      ></inline-choice>\n    </ng-container>\n  </div>\n</ng-container>\n",
        styles: [".item-wrapper-container{font-size:var(--font-size)!important}"]
    })
], ItemTypeWrapperComponent);
export { ItemTypeWrapperComponent };
//# sourceMappingURL=data:application/json;base64, 