package card;
import org.json.JSONObject;
public class CardInfo {
private int type;
private boolean is;
private int what;
private int from;
public CardInfo(int type, boolean is, int what, int from) {
this.type = type;
this.is = is;
this.what = what;
this.from = from;
}
public CardInfo(JSONObject jo){
fromJson(jo);
}
public JSONObject toJson(){
JSONObject root = new JSONObject();
root.put("type", type);
root.put("is", is);
root.put("what", what);
root.put("from", from);
return root;
}
private void fromJson(JSONObject jo){
type = jo.getInt("type");
is = jo.getBoolean("is");
what = jo.getInt("what");
from = jo.getInt("from");
}
public int getType() {
return type;
}
public boolean isIs() {
return is;
}
public int getWhat() {
return what;
}
public int getFrom() {
return from;
}
}