import { __decorate } from "tslib";
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
import { RationaleType, AssetPosition } from '../../../shared/models/summary.enum';
let RationaleComponent = class RationaleComponent {
    constructor() {
        this.RationaleValuesEnum = RationaleType;
        this.AssetPositionValuesEnum = AssetPosition;
    }
    ngOnInit() { }
    ngOnChanges(changes) {
        this.getRationaleDataDetails();
    }
    getRationaleDataDetails() {
        if (this.rationaleData && this.rationaleData.length > 0) {
            this.rationaleData.forEach(element => {
                if (element.outcomeType === this.RationaleValuesEnum.correctRationale && element.feedbackText != null) {
                    this.itemDetailsData = element;
                }
                else if (element.outcomeType === this.RationaleValuesEnum.correctRationale && element.feedbackText != null) {
                    this.itemDetailsData = element;
                }
            });
            this.rationaleAssets = this.itemDetailsData.rationaleAssets &&
                this.itemDetailsData.rationaleAssets.length > 0
                ? this.itemDetailsData.rationaleAssets
                : [];
            if (this.rationaleAssets && this.rationaleAssets.length > 0) {
                this.rationaleAssetPosition = this.rationaleAssets[0].assetsPosition;
            }
            this.showRationale = true;
        }
        else {
            this.showRationale = false;
        }
    }
};
__decorate([
    Input('itemData')
], RationaleComponent.prototype, "rationaleData", void 0);
__decorate([
    Input()
], RationaleComponent.prototype, "preferredTextFormat", void 0);
RationaleComponent = __decorate([
    Component({
        selector: 'lib-rationale',
        template: "<div class=\"common-full-width inline-paragraph\" *ngIf=\"showRationale\">\n  <ng-container *ngIf=\"rationaleAssets.length == 0; else rationaleWithAsset\">\n    <p\n      class=\"correct-rationale-section pt0-correct-rationale rational-strong-block\"\n    >\n      <strong>Rationale: </strong>\n      <span\n        libGetFormatText\n        [preferredTextFormat]=\"preferredTextFormat\"\n        [plainText]=\"itemDetailsData.feedbackText\"\n        [richText]=\"itemDetailsData.richFeedbackText\"\n      ></span>\n    </p>\n  </ng-container>\n  <ng-template #rationaleWithAsset>\n    <p class=\"correct-rationale-section pt0-correct-rationale\">\n      <strong>Rationale: </strong>\n    </p>\n    <media-carousel\n      [imagePath]=\"rationaleAssets[0].assetPath\"\n      [assetData]=\"rationaleAssets\"\n      [assetsPosition]=\"rationaleAssetPosition\"\n      *ngIf=\"\n        rationaleAssetPosition != AssetPositionValuesEnum.bottom &&\n        rationaleAssetPosition != AssetPositionValuesEnum.withInText\n      \"\n    ></media-carousel>\n    <div\n      class=\"wkqp-col-8\"\n      style=\"margin-right:0px;\"\n      [ngClass]=\"{\n        'wkqp-col-8': rationaleAssets.length != 0,\n        'wkqp-col-12':\n          rationaleAssets.length == 0 ||\n          rationaleAssetPosition == AssetPositionValuesEnum.withInText,\n        'right-assets-position-question':\n          rationaleAssetPosition == AssetPositionValuesEnum.right,\n        'left-assets-position-question':\n          rationaleAssetPosition == AssetPositionValuesEnum.left,\n        'top-assets-position-question':\n          rationaleAssetPosition == AssetPositionValuesEnum.top,\n        'bottom-assets-position-question':\n          rationaleAssetPosition == AssetPositionValuesEnum.bottom\n      }\"\n    >\n      <div class=\"wkqp-layout-item\">\n        <div class=\"wkqp-field-item normal-font mb0\">\n          <!--Prompt text-->\n          <div\n            class=\"wk-field-header mb20\"\n            *ngIf=\"rationaleAssetPosition != AssetPositionValuesEnum.withInText\"\n          >\n            <span\n              libGetFormatText\n              [preferredTextFormat]=\"preferredTextFormat\"\n              [plainText]=\"itemDetailsData.feedbackText\"\n              [richText]=\"itemDetailsData.richFeedbackText\"\n            ></span>\n          </div>\n\n          <div\n            class=\"wk-field-header mb0\"\n            *ngIf=\"rationaleAssetPosition == AssetPositionValuesEnum.withInText\"\n          >\n            <item-text-assets\n              [promptText]=\"itemDetailsData.feedbackText\"\n              [imagePath]=\"rationaleAssets[0].assetPath\"\n              [assetData]=\"rationaleAssets\"\n              [assetsPosition]=\"AssetPositionValuesEnum.withInText\"\n            ></item-text-assets>\n          </div>\n          <media-carousel\n            [imagePath]=\"rationaleAssets[0].assetPath\"\n            [assetData]=\"rationaleAssets\"\n            [assetsPosition]=\"rationaleAssetPosition\"\n            *ngIf=\"rationaleAssetPosition === AssetPositionValuesEnum.bottom\"\n          ></media-carousel>\n        </div>\n      </div>\n    </div>\n  </ng-template>\n</div>\n",
        changeDetection: ChangeDetectionStrategy.OnPush,
        styles: [".right-assets-position-question{float:left!important;padding-right:15px;width:64%}.left-assets-position-question{float:left!important;width:66%}"]
    })
], RationaleComponent);
export { RationaleComponent };
//# sourceMappingURL=data:application/json;base64, 