package dev.lions.user.manager.config;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.jackson.ObjectMapperCustomizer;
import jakarta.inject.Singleton;
import lombok.extern.slf4j.Slf4j;

/**
 * Configure Jackson globally to ignore unknown JSON properties.
 * This is required for forward compatibility with newer Keycloak versions (e.g. cpuInfo field).
 */
@Singleton
@Slf4j
public class JacksonConfig implements ObjectMapperCustomizer {

    @Override
    public void customize(ObjectMapper objectMapper) {
        log.info("### LIONS: Applying Jackson configuration for Keycloak compatibility ###");
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    }
}
