package org.studiorailgun.conversation.evaluators.synthesis;

import org.studiorailgun.conversation.evaluators.greet.GreetingEval;
import org.studiorailgun.conversation.evaluators.transfer.TransferEval;
import org.studiorailgun.conversation.tracking.Conversation;
import org.studiorailgun.conversation.tracking.Quote;

/**
 * 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 Quote evaluate(Conversation conversation){
        Quote response = null;
        switch(conversation.getGoalData().getGoal()){
            case GREET: {
                response = GreetingEval.constructGreeting(conversation);
                conversation.getGreetingData().getHaveGreeted().add(conversation.getSelf());
            } break;
            case ANSWER: {
                response = TransferEval.synthesize(conversation);
            } break;
            default: {
                throw new UnsupportedOperationException("Unsupported conversation goal! " + conversation.getGoalData().getGoal());
            }
        }
        return response;
    }

}
