import { AppObjectUC, getSingletonComponent, } from "@vived/core";
import { ShowAlertUC } from "../../Dispatcher/UC/ShowAlertUC";
import { ChallengeEntity } from "../Entities";
export class ShowChallengeHelpUC extends AppObjectUC {
}
ShowChallengeHelpUC.type = "ShowChallengeHelpUC";
ShowChallengeHelpUC.get = (appObjects) => getSingletonComponent(ShowChallengeHelpUC.type, appObjects);
export function makeShowChallengeHelpUC(appObject) {
    return new ShowChallengeHelpUCImp(appObject);
}
class ShowChallengeHelpUCImp extends ShowChallengeHelpUC {
    get challengeEntity() {
        return this.getCachedSingleton(ChallengeEntity.type);
    }
    get showAlertUC() {
        return this.getCachedSingleton(ShowAlertUC.type);
    }
    constructor(appObject) {
        super(appObject, ShowChallengeHelpUC.type);
        this.showChallengeHelp = () => {
            if (!this.challengeEntity || !this.showAlertUC)
                return;
            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