package at.procon.dip.clustering.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "dip.clustering.execution")
public record ClusteringExecutionProperties(
        int corePoolSize,
        int maxPoolSize,
        int queueCapacity
) {
    public int resolvedCorePoolSize() {
        return corePoolSize > 0 ? corePoolSize : 1;
    }

    public int resolvedMaxPoolSize() {
        return maxPoolSize > 0 ? maxPoolSize : Math.max(1, resolvedCorePoolSize());
    }

    public int resolvedQueueCapacity() {
        return queueCapacity >= 0 ? queueCapacity : 50;
    }
}
