use super::types::{AnomalyEvent, AnomalyResponse};
pub struct AnomalyResponder;
impl AnomalyResponder {
pub fn respond(event: &AnomalyEvent) -> AnomalyResponse {
match event.response {
AnomalyResponse::Pause => {
tracing::warn!(
anomaly_type = ?event.anomaly_type,
response = "pause",
agent_id = ?event.agent_id.as_bytes(),
description = %event.description,
"Anomaly detected: auto-pausing agent"
);
}
AnomalyResponse::Block => {
tracing::warn!(
anomaly_type = ?event.anomaly_type,
response = "block",
agent_id = ?event.agent_id.as_bytes(),
description = %event.description,
"Anomaly detected: blocking action"
);
}
AnomalyResponse::Alert => {
tracing::warn!(
anomaly_type = ?event.anomaly_type,
response = "alert",
agent_id = ?event.agent_id.as_bytes(),
description = %event.description,
"Anomaly detected: alert emitted"
);
}
AnomalyResponse::Quarantine => {
tracing::warn!(
anomaly_type = ?event.anomaly_type,
response = "quarantine",
agent_id = ?event.agent_id.as_bytes(),
description = %event.description,
"Anomaly detected: quarantining agent"
);
}
}
event.response
}
}