package io.wealthwizards.appsynctesting.utils.dynamodb;

import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import lombok.SneakyThrows;

import java.lang.reflect.Field;

public class FieldNamingStrategy implements com.google.gson.FieldNamingStrategy {
    @SneakyThrows
    @Override
    public String translateName(Field f) {
        var clazz = Field.class.getDeclaredField("clazz");
        clazz.setAccessible(true);

        var rootClazz = clazz.get(f);

        if (AttributeValue.class.equals(rootClazz)) {
            return f.getName().toUpperCase();
        }

        return f.getName();
    }
}
