package io.cameleer.server.core.runtime;

import java.time.Instant;
import java.util.Map;
import java.util.UUID;

public record Environment(
        UUID id,
        String slug,
        String displayName,
        boolean production,
        boolean enabled,
        Map<String, Object> defaultContainerConfig,
        Integer jarRetentionCount,
        String color,
        Instant createdAt,
        int executionRetentionDays,
        int logRetentionDays,
        int metricRetentionDays
) {
    public Environment {
        if (executionRetentionDays < 1) {
            throw new IllegalArgumentException(
                    "executionRetentionDays must be >= 1 (got " + executionRetentionDays + ")");
        }
        if (logRetentionDays < 1) {
            throw new IllegalArgumentException(
                    "logRetentionDays must be >= 1 (got " + logRetentionDays + ")");
        }
        if (metricRetentionDays < 1) {
            throw new IllegalArgumentException(
                    "metricRetentionDays must be >= 1 (got " + metricRetentionDays + ")");
        }
    }
}
