package it.integry.integrywmsnative.core.rest.deserializer;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;

import java.lang.reflect.Type;

import it.integry.integrywmsnative.core.model.secondary.StatoPartitaMag;

public class StatoPartitaMagDeserializer implements JsonDeserializer<StatoPartitaMag> {
    @Override
    public StatoPartitaMag deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        if (json.isJsonNull()) {
            return null;
        }

        int text = json.getAsInt();
        return StatoPartitaMag.from(text);
    }
}
