package app.mar.game.challenges;

import android.app.Activity;

import org.json.JSONException;
import org.json.JSONObject;

import app.mar.activities.QuestionFragment;
import app.mar.game.Game;

public class Question extends Challenge {

    protected String mQuestion;
    protected String mAnswer;
    protected String mGoodMessage;
    protected String mBadMessage;
    public static final int REQUEST_CODE=2004;


    public int getResultCode() { return REQUEST_CODE; }


    public Question(Game g,JSONObject root, Activity a) {
        super(root, QuestionFragment.class);

        try {
            mQuestion = root.getString("question");
            mAnswer = root.getString("answer");
            mGoodMessage = root.getString("good_message");
            mBadMessage = root.getString("bad_message");
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }




    public boolean checkAnswer(String answer)
    {
        return answer.toLowerCase().compareTo(mAnswer.toLowerCase())==0;
    }


    public String getQuestion() {
        return mQuestion;
    }

    public String getAnswer() {
        return mAnswer;
    }

    public String getGoodMessage() {
        return mGoodMessage;
    }

    public String getBadMessage() {
        return mBadMessage;
    }
}
