package org.studiorailgun.conversation.evaluators.synthesis;

import org.studiorailgun.conversation.evaluators.greet.GreetingEval;
import org.studiorailgun.conversation.evaluators.opener.OpenerSynthesis;
import org.studiorailgun.conversation.evaluators.transfer.TransferSynthesis;
import org.studiorailgun.conversation.tracking.Conversation;
import org.studiorailgun.conversation.tracking.Sentence;

/**
 * Evaluates any response the ai might want to construct
 */
public class ResponseEval {
    
    /**
     * Evaluates whether the ai wants to respond or not
     * @param conversation The conversation
     * @return The quote encapsulating the AI's response
     */
    public static Sentence evaluate(Conversation conversation){
        Sentence response = null;
        switch(conversation.getGoalData().getGoal()){
            case GREET: {
                response = GreetingEval.constructGreeting(conversation);
                conversation.getGreetingData().getHaveGreeted().add(conversation.getSelf());
            } break;
            case ANSWER: {
                response = TransferSynthesis.synthesize(conversation);
            } break;
            case OPENER: {
                response = OpenerSynthesis.synthesize(conversation);
            } break;
            default: {
                throw new UnsupportedOperationException("Unsupported conversation goal! " + conversation.getGoalData().getGoal());
            }
        }
        return response;
    }

}
