use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RawSignal {
pub id: String,
pub signal_type: String,
pub payload: serde_json::Value,
pub timestamp_ms: u64,
pub source: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ValidatedSignal {
pub id: String,
pub signal_type: SignalType,
pub payload: NormalizedPayload,
pub timestamp_ms: u64,
pub source: String,
pub validation: ValidationMetadata,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SignalType {
StateUpdate,
EdgeAdd,
EdgeRemove,
Observation,
PolicyUpdate,
Query,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum NormalizedPayload {
StateUpdate {
node_id: String,
state: Vec<f32>,
},
EdgeMod {
source: String,
target: String,
weight: Option<f32>,
},
Observation {
hypothesis_id: String,
observed: bool,
},
Json(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ValidationMetadata {
pub valid: bool,
pub warnings: Vec<String>,
pub schema_version: String,
pub normalizations: Vec<String>,
}
impl Default for ValidationMetadata {
fn default() -> Self {
Self {
valid: true,
warnings: Vec::new(),
schema_version: "1.0.0".to_string(),
normalizations: Vec::new(),
}
}
}