package macampcorp.macamp.game.challenges;

import android.app.Activity;

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

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

public class QRCodeTreasure extends Challenge {

    protected String mQRValue;
    protected String mComment;


    public static final int REQUEST_CODE=2003;

    public int getResultCode() { return REQUEST_CODE; }

    public QRCodeTreasure(Game g, JSONObject root, Activity a) {
        super(g, root, QRCodeFragment.class, a);

        try {
            mQRValue = root.getString("qr_value");

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


        try {
            mComment = root.getString("comment");
        }catch(JSONException e)
        {
            mComment="Retrouvez un QR Code proche de cet endroit";
        }
    }

    public String getComment() {
        return mComment;
    }

    public String getQRValue() {
        return mQRValue;
    }
}
