import { __decorate } from "tslib";
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { QuizService } from '../../../shared/service/quiz.service';
import { SummaryDisplayTypes } from '../../../shared/models';
var SummaryComponent = /** @class */ (function () {
    function SummaryComponent(quizService) {
        this.quizService = quizService;
        this.currentPage = 1;
        this.pageLoader = false;
        this.SummaryDisplayTypes = SummaryDisplayTypes;
        this.pageChanged = new EventEmitter();
        this.reportContentError = new EventEmitter();
        this.sendReportContentError = new EventEmitter();
    }
    SummaryComponent.prototype.ngOnChanges = function (changes) {
        var _this = this;
        this.quizService.isOnline = true;
        if (this.summaryDetails) {
            this.pageLoader = false;
            this.itemResponseDataHeader = this.summaryDetails.details;
            this.preferredTextFormat = this.testData.preferredTextFormat;
            if (this.summaryDetails.details &&
                this.summaryDetails.details.itemResponse &&
                this.summaryDetails.details.itemResponse.questionData) {
                var summaryDataRef = this.summaryDetails.details.itemResponse.questionData;
                // this.itemResponseDataHeader.summaryDisplay = 3;
                summaryDataRef.forEach(function (element, index, array) {
                    if (array[index - 1] &&
                        array[index - 1].parentLabelText === 'MEDICAL_CASE' &&
                        element.parentLabelText === 'MEDICAL_CASE') {
                        element.parentLabelText = 'Medical';
                        element.parentDetails = null;
                    }
                });
                this.itemResponseData = summaryDataRef;
                this.itemResponseData.forEach(function (element, index, array) {
                    element['questionTime'] = _this.itemResponseDataHeader.questionTime;
                    element['preferredTextFormat'] = _this.preferredTextFormat;
                    element.modelFeedback[0]['preferredTextFormat'] = _this.preferredTextFormat;
                });
            }
        }
    };
    SummaryComponent.prototype.ngOnInit = function () { };
    SummaryComponent.prototype.paginationChanged = function (page) {
        this.pageLoader = true;
        this.pageChanged.emit(page);
    };
    SummaryComponent.prototype.reportContentErrorDetails = function (clientDetails) {
        this.reportContentError.emit(clientDetails);
    };
    SummaryComponent.prototype.sendReportContentErrorDetails = function (mailContent) {
        this.sendReportContentError.emit(mailContent);
    };
    SummaryComponent.ctorParameters = function () { return [
        { type: QuizService }
    ]; };
    __decorate([
        Output()
    ], SummaryComponent.prototype, "pageChanged", void 0);
    __decorate([
        Output()
    ], SummaryComponent.prototype, "reportContentError", void 0);
    __decorate([
        Output()
    ], SummaryComponent.prototype, "sendReportContentError", void 0);
    __decorate([
        Input('testData')
    ], SummaryComponent.prototype, "testData", void 0);
    __decorate([
        Input('summaryData')
    ], SummaryComponent.prototype, "summaryDetails", void 0);
    __decorate([
        Input()
    ], SummaryComponent.prototype, "templateData", void 0);
    __decorate([
        Input()
    ], SummaryComponent.prototype, "mailSuccessData", void 0);
    SummaryComponent = __decorate([
        Component({
            selector: 'qp-summary',
            template: "<div\n  class=\"qp-summary\"\n  [ngClass]=\"{\n    'qp-summary-pre-defined':\n      itemResponseDataHeader.summaryDisplay ===\n      SummaryDisplayTypes.SummaryPredefined\n  }\"\n>\n  <lib-summary-header-details\n    [summaryData]=\"itemResponseDataHeader\"\n    [templateData]=\"templateData\"\n    [mailSuccessData]=\"mailSuccessData\"\n    (reportContentError)=\"reportContentErrorDetails($event)\"\n    (reportMailContent)=\"sendReportContentErrorDetails($event)\"\n    *ngIf=\"\n      itemResponseDataHeader.summaryDisplay !==\n      SummaryDisplayTypes.SummaryPredefined\n    \"\n  ></lib-summary-header-details>\n  <ng-container\n    *ngIf=\"\n      itemResponseDataHeader.summaryDisplay ===\n        SummaryDisplayTypes.SummaryDefault && !pageLoader\n    \"\n  >\n    <ng-container *ngFor=\"let item of itemResponseData\">\n      <ng-container>\n        <ng-container *ngIf=\"item.parentLabelText === 'MEDICAL_CASE'\"\n          ><lib-medical-case-summary\n            [summaryData]=\"item\"\n          ></lib-medical-case-summary\n        ></ng-container>\n        <ng-container *ngIf=\"item.parentLabelText === 'CLINICAL_SYMPTOMS'\"\n          ><lib-clinical-symptoms-summary\n            [summaryData]=\"item\"\n          ></lib-clinical-symptoms-summary\n        ></ng-container>\n      </ng-container>\n\n      <ng-container [ngSwitch]=\"item.itemType\">\n        <ng-container *ngSwitchCase=\"'1'\"\n          ><lib-multiple-choice-summary\n            [summaryData]=\"item\"\n          ></lib-multiple-choice-summary\n        ></ng-container>\n        <ng-container *ngSwitchCase=\"'2'\">\n          <lib-multiple-response-summary\n            [summaryData]=\"item\"\n          ></lib-multiple-response-summary>\n        </ng-container>\n        <ng-container *ngSwitchCase=\"'3'\">\n          <lib-fill-in-the-blanks-summary\n            [summaryData]=\"item\"\n          ></lib-fill-in-the-blanks-summary>\n        </ng-container>\n        <ng-container *ngSwitchCase=\"'4'\">\n          <lib-true-false-summary [summaryData]=\"item\"></lib-true-false-summary>\n        </ng-container>\n        <ng-container *ngSwitchCase=\"'24'\">\n          <lib-inline-choice-summary\n            [summaryData]=\"item\"\n          ></lib-inline-choice-summary>\n        </ng-container>\n        <ng-container *ngSwitchCase=\"'23'\">\n          <lib-graphic-option-summary\n            [summaryData]=\"item\"\n          ></lib-graphic-option-summary>\n        </ng-container>\n        <ng-container *ngSwitchCase=\"'13'\">\n          <lib-drag-and-drop-summary\n            [summaryData]=\"item\"\n          ></lib-drag-and-drop-summary>\n        </ng-container>\n        <ng-container *ngSwitchCase=\"'12'\">\n          <lib-hot-spot-summary [summaryData]=\"item\"></lib-hot-spot-summary>\n        </ng-container>\n        <ng-container *ngSwitchCase=\"'17'\">\n          <lib-figure-labeling-summary\n            [summaryData]=\"item\"\n          ></lib-figure-labeling-summary>\n        </ng-container>\n      </ng-container>\n    </ng-container>\n  </ng-container>\n  <ng-container\n    *ngIf=\"\n      itemResponseDataHeader.summaryDisplay ===\n        SummaryDisplayTypes.SummaryDefault && itemResponseData.length > 0\n    \"\n  >\n    <lib-summary-pagination\n      [totalquestions]=\"summaryDetails.details.totalQuestions\"\n      [currentPage]=\"currentPage\"\n      (pageChanged)=\"paginationChanged($event)\"\n      [ngStyle]=\"{ visibility: pageLoader ? 'hidden' : 'visible' }\"\n    ></lib-summary-pagination>\n  </ng-container>\n\n  <ng-container>\n    <div\n      *ngIf=\"\n        itemResponseDataHeader.summaryPredefinedText != null &&\n        itemResponseDataHeader.summaryDisplay ===\n          SummaryDisplayTypes.SummaryPredefined\n      \"\n      class=\"summary-pre-defined-text\"\n    >\n      <p>{{ itemResponseDataHeader.summaryPredefinedText }}</p>\n    </div>\n  </ng-container>\n\n  <ng-container *ngIf=\"pageLoader\">\n    <div class=\"loader-container\">\n      <span class=\"wk-icon-spin wk-spin wkqp-spin-center\"></span>\n    </div>\n  </ng-container>\n</div>\n",
            styles: ["body,html{overflow:inherit}.qp-summary{flex:1;display:flex;flex-direction:column;height:100%;width:75rem;margin:0 auto}:host ::ng-deep lib-medical-case-summary.wkqb-question-number{float:left}:host ::ng-deep lib-medical-case-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-medical-case-summary.wrong-checkmark{top:0}:host ::ng-deep lib-medical-case-summary.green-checkmark{top:0}:host ::ng-deep lib-medical-case-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-clinical-symptoms-summary.wkqb-question-number{float:left}:host ::ng-deep lib-clinical-symptoms-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-clinical-symptoms-summary.wrong-checkmark{top:0}:host ::ng-deep lib-clinical-symptoms-summary.green-checkmark{top:0}:host ::ng-deep lib-clinical-symptoms-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-multiple-choice-summary.wkqb-question-number{float:left}:host ::ng-deep lib-multiple-choice-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-multiple-choice-summary.wrong-checkmark{top:0}:host ::ng-deep lib-multiple-choice-summary.green-checkmark{top:0}:host ::ng-deep lib-multiple-choice-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-multiple-response-summary.wkqb-question-number{float:left}:host ::ng-deep lib-multiple-response-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-multiple-response-summary.wrong-checkmark{top:0}:host ::ng-deep lib-multiple-response-summary.green-checkmark{top:0}:host ::ng-deep lib-multiple-response-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-fill-in-the-blanks-summary.wkqb-question-number{float:left}:host ::ng-deep lib-fill-in-the-blanks-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-fill-in-the-blanks-summary.wrong-checkmark{top:0}:host ::ng-deep lib-fill-in-the-blanks-summary.green-checkmark{top:0}:host ::ng-deep lib-fill-in-the-blanks-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-true-false-summary.wkqb-question-number{float:left}:host ::ng-deep lib-true-false-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-true-false-summary.wrong-checkmark{top:0}:host ::ng-deep lib-true-false-summary.green-checkmark{top:0}:host ::ng-deep lib-true-false-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-inline-choice-summary.wkqb-question-number{float:left}:host ::ng-deep lib-inline-choice-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-inline-choice-summary.wrong-checkmark{top:0}:host ::ng-deep lib-inline-choice-summary.green-checkmark{top:0}:host ::ng-deep lib-inline-choice-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-graphic-option-summary.wkqb-question-number{float:left}:host ::ng-deep lib-graphic-option-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-graphic-option-summary.wrong-checkmark{top:0}:host ::ng-deep lib-graphic-option-summary.green-checkmark{top:0}:host ::ng-deep lib-graphic-option-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-drag-and-drop-summary.wkqb-question-number{float:left}:host ::ng-deep lib-drag-and-drop-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-drag-and-drop-summary.wrong-checkmark{top:0}:host ::ng-deep lib-drag-and-drop-summary.green-checkmark{top:0}:host ::ng-deep lib-drag-and-drop-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-hot-spot-summary.wkqb-question-number{float:left}:host ::ng-deep lib-hot-spot-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-hot-spot-summary.wrong-checkmark{top:0}:host ::ng-deep lib-hot-spot-summary.green-checkmark{top:0}:host ::ng-deep lib-hot-spot-summary.wkqp-unattempted{top:-2px}:host ::ng-deep lib-figure-labeling-summary.wkqb-question-number{float:left}:host ::ng-deep lib-figure-labeling-summary.wkqp-badge-danger{top:-4px}:host ::ng-deep lib-figure-labeling-summary.wrong-checkmark{top:0}:host ::ng-deep lib-figure-labeling-summary.green-checkmark{top:0}:host ::ng-deep lib-figure-labeling-summary.wkqp-unattempted{top:-2px}.loader-container{position:absolute;top:425px;left:50%;transform:translate(-50%,0);text-align:center}.loader-container span{font-size:50px;color:var(--primary-color)}.loader-container h2{font-size:24px;text-align:center;width:100%;margin:0;padding:0}.hidden{visibility:hidden}.summary-pre-defined-text{width:500px;padding-top:105px;text-align:center;padding-bottom:105px;position:absolute;top:50%;right:50%;transform:translate(50%,-50%);background-color:#fff;border:1px solid #ccc}.summary-pre-defined-text:hover{background-color:#d4e8b1}.qp-summary-pre-defined{display:flex;width:100%;padding-bottom:20px;max-width:75rem;margin-left:auto;margin-right:auto;background-color:#ededed;height:100vh;max-width:100%}.qp-summary-pre-defined::before{position:absolute;top:0;left:0;width:100%;height:100vh;background-color:#ededed;z-index:-1;content:''}"]
        })
    ], SummaryComponent);
    return SummaryComponent;
}());
export { SummaryComponent };
//# sourceMappingURL=data:application/json;base64, 