// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/BindOkPack.java
// public class BindOkPack extends Pack {
//     public static String TYPE = "bindok";
// 
//     public String key;
// 
//     @SerializedName("r")
//     public int resultCode;
// 
//     public BindOkPack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/BindPack.java
// public class BindPack extends Pack {
//     public static String TYPE = "bind";
// 
//     public int uid;
// 
//     public BindPack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/DatPack.java
// public class DatPack extends Pack {
//     public static String TYPE = "dat";
// 
//     @SerializedName("r")
//     public int resultCode;
// 
//     @SerializedName("cols")
//     public String[] keys;
// 
//     @SerializedName("dat")
//     public Integer[] values;
// 
//     public DatPack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/DevicePack.java
// public class DevicePack extends Pack {
//     public static String TYPE = "dev";
// 
//     public String cid;
//     public String bc;
//     public String brand;
//     public String catalog;
//     public String mid;
//     public String model;
//     public String name;
//     public String series;
//     public String ver;
//     public Integer lock;
// 
//     @SerializedName("vender")
//     public String vendor;
// 
//     public DevicePack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/Pack.java
// public class Pack {
//     @SerializedName("t")
//     public String type;
// 
//     public String mac;
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/ResultPack.java
// public class ResultPack extends Pack {
//     public static String TYPE = "res";
// 
//     @SerializedName("r")
//     public int resultCode;
// 
//     @SerializedName("opt")
//     public String[] keys;
// 
//     @SerializedName("p")
//     public Integer[] values;
// 
//     public ResultPack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/StatusPack.java
// public class StatusPack extends Pack {
//     public static String TYPE = "status";
// 
//     @SerializedName("cols")
//     public String[] keys;
// 
//     public StatusPack() {
//         type = TYPE;
//     }
// }


import tomikaa.greeremote.Gree.Packs.BindOkPack;
import tomikaa.greeremote.Gree.Packs.BindPack;
import tomikaa.greeremote.Gree.Packs.DatPack;
import tomikaa.greeremote.Gree.Packs.DevicePack;
import tomikaa.greeremote.Gree.Packs.Pack;
import tomikaa.greeremote.Gree.Packs.ResultPack;
import tomikaa.greeremote.Gree.Packs.StatusPack;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
package tomikaa.greeremote.Gree.Deserializers;



/*
 * This file is part of GreeRemoteAndroid.
 *
 * GreeRemoteAndroid 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.
 *
 * GreeRemoteAndroid 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 GreeRemoteAndroid. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Created by tomikaa87 <https://github.com/tomikaa87> on 2017-11-26.
 */

public class PackDeserializer implements JsonDeserializer<Pack> {

    @Override
    public Pack deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
        JsonObject jsonObject = jsonElement.getAsJsonObject();

        String packType = jsonObject.get("t").getAsString();

        if (packType.equalsIgnoreCase(BindOkPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, BindOkPack.class);
        } else if (packType.equalsIgnoreCase(BindPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, BindPack.class);
        } else if (packType.equalsIgnoreCase(DatPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, DatPack.class);
        } else if (packType.equalsIgnoreCase(ResultPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, ResultPack.class);
        } else if (packType.equalsIgnoreCase(StatusPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, StatusPack.class);
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/BindOkPack.java
// public class BindOkPack extends Pack {
//     public static String TYPE = "bindok";
// 
//     public String key;
// 
//     @SerializedName("r")
//     public int resultCode;
// 
//     public BindOkPack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/BindPack.java
// public class BindPack extends Pack {
//     public static String TYPE = "bind";
// 
//     public int uid;
// 
//     public BindPack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/DatPack.java
// public class DatPack extends Pack {
//     public static String TYPE = "dat";
// 
//     @SerializedName("r")
//     public int resultCode;
// 
//     @SerializedName("cols")
//     public String[] keys;
// 
//     @SerializedName("dat")
//     public Integer[] values;
// 
//     public DatPack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/DevicePack.java
// public class DevicePack extends Pack {
//     public static String TYPE = "dev";
// 
//     public String cid;
//     public String bc;
//     public String brand;
//     public String catalog;
//     public String mid;
//     public String model;
//     public String name;
//     public String series;
//     public String ver;
//     public Integer lock;
// 
//     @SerializedName("vender")
//     public String vendor;
// 
//     public DevicePack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/Pack.java
// public class Pack {
//     @SerializedName("t")
//     public String type;
// 
//     public String mac;
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/ResultPack.java
// public class ResultPack extends Pack {
//     public static String TYPE = "res";
// 
//     @SerializedName("r")
//     public int resultCode;
// 
//     @SerializedName("opt")
//     public String[] keys;
// 
//     @SerializedName("p")
//     public Integer[] values;
// 
//     public ResultPack() {
//         type = TYPE;
//     }
// }
// 
// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Packs/StatusPack.java
// public class StatusPack extends Pack {
//     public static String TYPE = "status";
// 
//     @SerializedName("cols")
//     public String[] keys;
// 
//     public StatusPack() {
//         type = TYPE;
//     }
// }


// Path: GreeRemoteAndroid/app/src/main/java/tomikaa/greeremote/Gree/Deserializers/PackDeserializer.java
import tomikaa.greeremote.Gree.Packs.BindOkPack;
import tomikaa.greeremote.Gree.Packs.BindPack;
import tomikaa.greeremote.Gree.Packs.DatPack;
import tomikaa.greeremote.Gree.Packs.DevicePack;
import tomikaa.greeremote.Gree.Packs.Pack;
import tomikaa.greeremote.Gree.Packs.ResultPack;
import tomikaa.greeremote.Gree.Packs.StatusPack;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;

package tomikaa.greeremote.Gree.Deserializers;



/*
 * This file is part of GreeRemoteAndroid.
 *
 * GreeRemoteAndroid 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.
 *
 * GreeRemoteAndroid 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 GreeRemoteAndroid. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Created by tomikaa87 <https://github.com/tomikaa87> on 2017-11-26.
 */

public class PackDeserializer implements JsonDeserializer<Pack> {

    @Override
    public Pack deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
        JsonObject jsonObject = jsonElement.getAsJsonObject();

        String packType = jsonObject.get("t").getAsString();

        if (packType.equalsIgnoreCase(BindOkPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, BindOkPack.class);
        } else if (packType.equalsIgnoreCase(BindPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, BindPack.class);
        } else if (packType.equalsIgnoreCase(DatPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, DatPack.class);
        } else if (packType.equalsIgnoreCase(ResultPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, ResultPack.class);
        } else if (packType.equalsIgnoreCase(StatusPack.TYPE)) {
            return jsonDeserializationContext.deserialize(jsonObject, StatusPack.class);
        } else if (packType.equalsIgnoreCase(DevicePack.TYPE)) {