/*
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

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;
    }
}
