package com.reading.platform.common.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * Jackson serializer that converts string values to uppercase.
 * Used to normalize status fields from DB (lowercase) to JSON output (uppercase).
 */
public class UpperCaseSerializer extends JsonSerializer<String> {

    @Override
    public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        gen.writeString(value != null ? value.toUpperCase() : null);
    }
}
