// Path: app/src/main/java/com/steevsapps/idledaddy/steam/model/Game.java
// public class Game implements Comparable<Game>, Parcelable {
//     private final static String IMG_URL = "http://media.steampowered.com/steamcommunity/public/images/apps/%d/%s.jpg";
// 
//     @SerializedName("appid")
//     public int appId;
//     @SerializedName("name")
//     public String name;
//     @SerializedName("img_logo_url")
//     public String iconUrl;
//     @SerializedName("playtime_forever")
//     public float hoursPlayed;
//     @SerializedName("drops_remaining")
//     public int dropsRemaining;
// 
//     public Game(int appId, String name, float hoursPlayed, int dropsRemaining) {
//         this.appId = appId;
//         this.name = name;
//         this.iconUrl = "http://cdn.akamai.steamstatic.com/steam/apps/" + appId + "/header_292x136.jpg";
//         this.hoursPlayed = hoursPlayed;
//         this.dropsRemaining = dropsRemaining;
//     }
// 
//     private Game(Parcel parcel) {
//         appId = parcel.readInt();
//         name = parcel.readString();
//         iconUrl = parcel.readString();
//         hoursPlayed = parcel.readFloat();
//         dropsRemaining = parcel.readInt();
//     }
// 
//     @Override
//     public int compareTo(@NonNull Game game) {
//         if (hoursPlayed == game.hoursPlayed) {
//             return 0;
//         }
//         return hoursPlayed < game.hoursPlayed ? -1 : 1;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == this) {
//             return true;
//         }
//         if (obj == null) {
//             return false;
//         }
//         if (obj.getClass() != getClass()) {
//             return false;
//         }
//         final Game otherGame = (Game) obj;
//         return otherGame.appId == appId;
//     }
// 
//     @Override
//     public int hashCode() {
//         // Start with a non-zero constant. Prime is preferred
//         int result = 17;
//         // Include a hash for each field
//         result = 31 * result + appId;
//         return result;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel parcel, int i) {
//         parcel.writeInt(appId);
//         parcel.writeString(name);
//         parcel.writeString(iconUrl);
//         parcel.writeFloat(hoursPlayed);
//         parcel.writeInt(dropsRemaining);
//     }
// 
//     public final static Parcelable.Creator<Game> CREATOR = new Parcelable.Creator<Game>() {
//         @Override
//         public Game createFromParcel(Parcel parcel) {
//             return new Game(parcel);
//         }
// 
//         @Override
//         public Game[] newArray(int i) {
//             return new Game[i];
//         }
//     };
// }
// 
// Path: app/src/main/java/com/steevsapps/idledaddy/steam/model/GamesOwnedResponse.java
// public class GamesOwnedResponse {
//     @SerializedName("game_count")
//     private int count;
// 
//     @SerializedName("games")
//     private List<Game> games;
// 
//     public int getCount() {
//         return count;
//     }
// 
//     public List<Game> getGames() {
//         return games;
//     }
// }


import com.google.gson.Gson;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.steevsapps.idledaddy.steam.model.Game;
import com.steevsapps.idledaddy.steam.model.GamesOwnedResponse;
import java.lang.reflect.Type;
import java.util.Locale;
package com.steevsapps.idledaddy.steam.converter;



public class GamesOwnedResponseDeserializer implements JsonDeserializer<GamesOwnedResponse> {
    private final static String IMG_URL = "http://media.steampowered.com/steamcommunity/public/images/apps/%d/%s.jpg";

    @Override
    public GamesOwnedResponse deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        final JsonElement element = json.getAsJsonObject().get("response");
        final GamesOwnedResponse response = new Gson().fromJson(element, GamesOwnedResponse.class);

// Path: app/src/main/java/com/steevsapps/idledaddy/steam/model/Game.java
// public class Game implements Comparable<Game>, Parcelable {
//     private final static String IMG_URL = "http://media.steampowered.com/steamcommunity/public/images/apps/%d/%s.jpg";
// 
//     @SerializedName("appid")
//     public int appId;
//     @SerializedName("name")
//     public String name;
//     @SerializedName("img_logo_url")
//     public String iconUrl;
//     @SerializedName("playtime_forever")
//     public float hoursPlayed;
//     @SerializedName("drops_remaining")
//     public int dropsRemaining;
// 
//     public Game(int appId, String name, float hoursPlayed, int dropsRemaining) {
//         this.appId = appId;
//         this.name = name;
//         this.iconUrl = "http://cdn.akamai.steamstatic.com/steam/apps/" + appId + "/header_292x136.jpg";
//         this.hoursPlayed = hoursPlayed;
//         this.dropsRemaining = dropsRemaining;
//     }
// 
//     private Game(Parcel parcel) {
//         appId = parcel.readInt();
//         name = parcel.readString();
//         iconUrl = parcel.readString();
//         hoursPlayed = parcel.readFloat();
//         dropsRemaining = parcel.readInt();
//     }
// 
//     @Override
//     public int compareTo(@NonNull Game game) {
//         if (hoursPlayed == game.hoursPlayed) {
//             return 0;
//         }
//         return hoursPlayed < game.hoursPlayed ? -1 : 1;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == this) {
//             return true;
//         }
//         if (obj == null) {
//             return false;
//         }
//         if (obj.getClass() != getClass()) {
//             return false;
//         }
//         final Game otherGame = (Game) obj;
//         return otherGame.appId == appId;
//     }
// 
//     @Override
//     public int hashCode() {
//         // Start with a non-zero constant. Prime is preferred
//         int result = 17;
//         // Include a hash for each field
//         result = 31 * result + appId;
//         return result;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel parcel, int i) {
//         parcel.writeInt(appId);
//         parcel.writeString(name);
//         parcel.writeString(iconUrl);
//         parcel.writeFloat(hoursPlayed);
//         parcel.writeInt(dropsRemaining);
//     }
// 
//     public final static Parcelable.Creator<Game> CREATOR = new Parcelable.Creator<Game>() {
//         @Override
//         public Game createFromParcel(Parcel parcel) {
//             return new Game(parcel);
//         }
// 
//         @Override
//         public Game[] newArray(int i) {
//             return new Game[i];
//         }
//     };
// }
// 
// Path: app/src/main/java/com/steevsapps/idledaddy/steam/model/GamesOwnedResponse.java
// public class GamesOwnedResponse {
//     @SerializedName("game_count")
//     private int count;
// 
//     @SerializedName("games")
//     private List<Game> games;
// 
//     public int getCount() {
//         return count;
//     }
// 
//     public List<Game> getGames() {
//         return games;
//     }
// }


// Path: app/src/main/java/com/steevsapps/idledaddy/steam/converter/GamesOwnedResponseDeserializer.java
import com.google.gson.Gson;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.steevsapps.idledaddy.steam.model.Game;
import com.steevsapps.idledaddy.steam.model.GamesOwnedResponse;
import java.lang.reflect.Type;
import java.util.Locale;

package com.steevsapps.idledaddy.steam.converter;



public class GamesOwnedResponseDeserializer implements JsonDeserializer<GamesOwnedResponse> {
    private final static String IMG_URL = "http://media.steampowered.com/steamcommunity/public/images/apps/%d/%s.jpg";

    @Override
    public GamesOwnedResponse deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        final JsonElement element = json.getAsJsonObject().get("response");
        final GamesOwnedResponse response = new Gson().fromJson(element, GamesOwnedResponse.class);

        for (Game game : response.getGames()) {