package com.example.fitbot.speech;

import com.aldebaran.qi.sdk.QiContext;
import com.aldebaran.qi.sdk.builder.SayBuilder;
import com.aldebaran.qi.sdk.object.locale.Language;
import com.aldebaran.qi.sdk.object.locale.Locale;
import com.aldebaran.qi.sdk.object.locale.Region;

/**
 * SpeechGenerator class for generating speech for the robot
 */
public class SpeechGenerator {

    private static final Locale DUTCH_LOCALE = new Locale(Language.DUTCH, Region.NETHERLANDS);
    private SayBuilder builder;

    /**
     * Function for making the robot say something with DUTCH_LOCALE as locale
     * @param phrase The phrase to make the robot say
     * @param ctx The QiContext to use
     */
    public static void say(String phrase, QiContext ctx)
    {
        say(phrase, ctx, DUTCH_LOCALE);
    }

    /**
     * Function for making the robot say something with a specific locale
     * @param phrase The phrase to make the robot say
     * @param ctx The QiContext to use
     * @param locale The locale to use
     */
    public static void say(String phrase, QiContext ctx, Locale locale)
    {
        SayBuilder
                .with(ctx)
                .withLocale(locale)
                .withText(phrase)
                .build()
                .run();
    }

}
