package at.procon.eventhub.processing.eventprocessing.module;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public record RuntimeProcessingModuleResult(
        String moduleKey,
        RuntimeProcessingModuleStatus status,
        Object output,
        Map<String, Object> metadata,
        List<String> warnings
) {
    public RuntimeProcessingModuleResult {
        metadata = metadata == null ? Map.of() : Collections.unmodifiableMap(new LinkedHashMap<>(metadata));
        warnings = warnings == null ? List.of() : List.copyOf(warnings);
    }
}
