package at.procon.eventhub.dto;

import com.fasterxml.jackson.databind.JsonNode;
import jakarta.validation.constraints.NotBlank;

/**
 * Generic, normalized event-specific attributes.
 *
 * Common fields stay on EventHubEventDto. Provider-specific raw values stay in
 * payload. Reusable semantic attributes such as cardSlot, countryFrom, or
 * operation are placed here under a detail type.
 */
public record EventDetailsDto(
        @NotBlank String type,
        JsonNode attributes
) {
    public EventDetailsDto {
        if (type != null) {
            type = type.trim().toUpperCase().replace('-', '_').replace(' ', '_');
        }
    }
}
