package com.cameleer.server.core.alerting;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "kind", include = JsonTypeInfo.As.EXISTING_PROPERTY, visible = true)
@JsonSubTypes({
    @JsonSubTypes.Type(value = RouteMetricCondition.class,     name = "ROUTE_METRIC"),
    @JsonSubTypes.Type(value = ExchangeMatchCondition.class,   name = "EXCHANGE_MATCH"),
    @JsonSubTypes.Type(value = AgentStateCondition.class,      name = "AGENT_STATE"),
    @JsonSubTypes.Type(value = AgentLifecycleCondition.class,  name = "AGENT_LIFECYCLE"),
    @JsonSubTypes.Type(value = DeploymentStateCondition.class, name = "DEPLOYMENT_STATE"),
    @JsonSubTypes.Type(value = LogPatternCondition.class,      name = "LOG_PATTERN"),
    @JsonSubTypes.Type(value = JvmMetricCondition.class,       name = "JVM_METRIC")
})
public sealed interface AlertCondition permits
    RouteMetricCondition, ExchangeMatchCondition, AgentStateCondition,
    AgentLifecycleCondition, DeploymentStateCondition, LogPatternCondition,
    JvmMetricCondition {

    @JsonProperty("kind")
    ConditionKind kind();
    AlertScope scope();
}
