use crate::vault::vault_structs::{VaultMemory, EmotionalCongruence};
#[derive(Debug)]
pub enum ReflexAction {
Allow,
Block { reason: String },
OverrideRequired { reason: String },
}
pub struct ReflexOverrideEngine {
threshold: f32,
}
impl ReflexOverrideEngine {
pub fn new(threshold: f32) -> Self {
Self { threshold }
}
pub fn evaluate(
&self,
vault: &VaultMemory,
congruence: Option<&EmotionalCongruence>,
) -> ReflexAction {
match congruence {
Some(c) => {
if c.congruence_score >= self.threshold {
ReflexAction::Allow
} else {
ReflexAction::OverrideRequired {
reason: format!(
"Incongruent tone ({} vs {}). Score: {}",
c.tone_emotion, c.facial_emotion, c.congruence_score
),
}
}
}
None => ReflexAction::Block {
reason: "No congruence data available".into(),
},
}
}
}