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

import java.util.Set;

public record RuntimeProcessingModuleDescriptorDto(
        String moduleKey,
        String displayName,
        String description,
        String engine,
        Set<String> producedStreams
) {
    public RuntimeProcessingModuleDescriptorDto {
        if (moduleKey == null || moduleKey.isBlank()) {
            throw new IllegalArgumentException("moduleKey must not be blank");
        }
        moduleKey = moduleKey.trim();
        displayName = displayName == null || displayName.isBlank() ? moduleKey : displayName.trim();
        description = description == null ? "" : description;
        engine = engine == null || engine.isBlank() ? "UNKNOWN" : engine.trim();
        producedStreams = producedStreams == null ? Set.of() : Set.copyOf(producedStreams);
    }
}
