package belight;

import com.amazon.speech.speechlet.Session;

/**
 * Created 4/16/16. Description...
 *
 * @author Neo Li. <neo.siqi.li@hotmail.com>
 */
public class ResponseGenerator {
    public static String getInitialPrompt(Session session) {
        return "I don't know. What did you have so far?";
    }

    public static String getWhatIEatResponse(Session session, FoodItem foodItem) {
        final int residualInCalories = SessionHelper.getResidualInCalories(session, foodItem);

        if (residualInCalories <= 0) {
            return String.format("You ate %s.  %d calories over your goal. Be careful.", foodItem
                    .getName(), foodItem
                    .getCalories());
        } else if (foodItem.isBadFood()) {
            return String.format("%s is bad. It is %d calories. Be careful.", foodItem.getName(),
                                 foodItem.getCalories());

        } else {
            return String.format("%s is %d calories. You are doing great.", foodItem.getName(),
                    foodItem.getCalories());
        }
    }

    public static String getWhatElseCanIEat(Session session) {
        String eatenAlready = SessionHelper.getCurrentIntakeFoodNames(session);
        Integer residualInCalories = SessionHelper.caloriesMax - SessionHelper
                .getCurrentIntakeCalories(session);

        String response = "You had eaten " + eatenAlready + ". Total intake calories are " +
                residualInCalories;

        // increase already eat too much, or can't find a suitable items.
        String recommendation = "Sorry, I don't know. I'll find out.";

        for (FoodItem item : FoodDAO.foodItems.values()) {
            if (!eatenAlready.contains(item.getName()) && residualInCalories + item.getCalories() <
                    SessionHelper.caloriesMax) {
                recommendation = "I recommend  " + item.getName() + ", which is " + item
                        .getCalories() + " calories. And you can buy it from " + item.getBuyAt()
                        + ". Do you want me to order?";
            }
        }

        return response + recommendation;
    }
}

@@ -599,27 +599,31 @@
 r goal. 
-Be careful.
+Are you serious
 %22, foodI

fix the tone when you break your goal