package com.cameleer.server.app.alerting.eval;

import java.util.List;
import java.util.Map;

public sealed interface EvalResult {

    record Firing(Double currentValue, Double threshold, Map<String, Object> context) implements EvalResult {
        public Firing {
            context = context == null ? Map.of() : Map.copyOf(context);
        }
    }

    record Clear() implements EvalResult {
        public static final Clear INSTANCE = new Clear();
    }

    record Error(Throwable cause) implements EvalResult {}

    record Batch(List<Firing> firings) implements EvalResult {
        public Batch {
            firings = firings == null ? List.of() : List.copyOf(firings);
        }
    }
}
