"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShowChallengeHelpUC = void 0;
exports.makeShowChallengeHelpUC = makeShowChallengeHelpUC;
const core_1 = require("@vived/core");
const ShowAlertUC_1 = require("../../Dispatcher/UC/ShowAlertUC");
const Entities_1 = require("../Entities");
class ShowChallengeHelpUC extends core_1.AppObjectUC {
}
exports.ShowChallengeHelpUC = ShowChallengeHelpUC;
ShowChallengeHelpUC.type = "ShowChallengeHelpUC";
ShowChallengeHelpUC.get = (appObjects) => (0, core_1.getSingletonComponent)(ShowChallengeHelpUC.type, appObjects);
function makeShowChallengeHelpUC(appObject) {
    return new ShowChallengeHelpUCImp(appObject);
}
class ShowChallengeHelpUCImp extends ShowChallengeHelpUC {
    get challengeEntity() {
        return this.getCachedSingleton(Entities_1.ChallengeEntity.type);
    }
    get showAlertUC() {
        return this.getCachedSingleton(ShowAlertUC_1.ShowAlertUC.type);
    }
    constructor(appObject) {
        super(appObject, ShowChallengeHelpUC.type);
        this.showChallengeHelp = () => {
            if (!this.challengeEntity || !this.showAlertUC)
                return;
            ShowAlertUC_1.ShowAlertUC.get(this.appObjects);
            const title = this.challengeEntity.selectedChallengeHeading;
            const message = this.challengeEntity.selectedChallengeConsumerHelp;
            if (!title || !message) {
                this.warn("Title or message is empty");
                return;
            }
            const alertDTO = {
                title,
                message,
                closeButtonLabel: "Close",
                closeCallback: () => { },
            };
            this.showAlertUC.showAlert(alertDTO);
        };
        this.appObjects.registerSingleton(this);
    }
}
//# sourceMappingURL=ShowChallengeHelpUC.js.map