package org.studiorailgun.ai.conversation.evaluators.synthesis;

import org.studiorailgun.ai.conversation.evaluators.greet.GreetingEval;
import org.studiorailgun.ai.conversation.evaluators.opener.OpenerSynthesis;
import org.studiorailgun.ai.conversation.evaluators.transfer.TransferSynthesis;
import org.studiorailgun.ai.conversation.tracking.Conversation;
import org.studiorailgun.ai.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 TRANSMIT_INFO: {
                response = TransferSynthesis.synthesize(conversation);
            } break;
            case OPENER: {
                response = OpenerSynthesis.synthesize(conversation);
            } break;
            default: {
                throw new UnsupportedOperationException("Unsupported conversation goal! " + conversation.getGoalData().getGoal());
            }
        }
        return response;
    }

}
