package macampcorp.macamp.game.challenges;

import android.app.Activity;

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

import java.util.ArrayList;

import macampcorp.macamp.activities.fragments.QCMFragment;
import macampcorp.macamp.exceptions.BadChallengeConfigException;
import macampcorp.macamp.game.Game;

public class QCM extends Question{

    public static final String CHALLENGE_QCM="qcm";
    protected ArrayList<String> mChoices = new ArrayList<String>();
    public static final int REQUEST_CODE=2002;



    public int getResultCode() { return REQUEST_CODE; }

    public QCM(Game g, JSONObject root, Activity a) {
        super(g, root, a);
        mStartWith= QCMFragment.class;
        try {
            JSONArray arr = root.getJSONArray("choices");
            for(int i=0; i<arr.length(); i++)
                mChoices.add(arr.getString(i));

        }catch(JSONException e)
        {
            e.printStackTrace();
            throw new BadChallengeConfigException("Bad parameter 'choices'");
        }
    }

    public ArrayList<String> getChoices() {
        return mChoices;
    }
}
