"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toggleAnswerIsCorrect = toggleAnswerIsCorrect;
const QuestionEntity_1 = require("../Entities/QuestionEntity");
const ToggleQuestionAnswerIsCorrect_1 = require("../UC/ToggleQuestionAnswerIsCorrect");
function toggleAnswerIsCorrect(answerID, appObjects) {
    const questionEntity = QuestionEntity_1.QuestionEntity.get(appObjects);
    if (!questionEntity) {
        appObjects.submitWarning("toggleAnswerIsCorrect", "Can't find QuestionEntity");
        return;
    }
    const answer = questionEntity.getAnswer(answerID);
    if (!answer) {
        appObjects.submitWarning("toggleAnswerIsCorrect", "Can't find Answer by ID");
        return;
    }
    const uc = answer.appObject.getComponent(ToggleQuestionAnswerIsCorrect_1.ToggleQuestionChallengeAnswerIsCorrectUC.type);
    if (!uc) {
        appObjects.submitWarning("toggleAnswerIsCorrect", "Can't find ToggleQuestionChallengeAnswerIsCorrectUC on Answer");
        return;
    }
    uc.toggleIsCorrect();
}
//# sourceMappingURL=toggleAnswerIsCorrect.js.map