use super::types::{Severity, SocraticFinding, Track};
pub fn emit_finding(f: &SocraticFinding, source: Option<uuid::Uuid>) {
use crate::pane::output::{kinds, Lifetime, Message, Severity as OutSev};
let severity = match f.severity {
Severity::Probe => OutSev::Contradiction,
Severity::Inquiry => OutSev::Warning,
Severity::Notice => OutSev::Info,
};
let track = match f.category.track() {
Track::Fast => "fast",
Track::Slow => "slow",
};
let mut msg = Message::new(
kinds::SOCRATIC_INQUIRY,
severity,
Lifetime::UntilActedOn,
serde_json::json!({
"text": f.question,
"question_en": f.question_en,
"category": f.category.id(),
"label": f.category.label(),
"persona_id": f.persona_id,
"track": track,
"severity_label": f.severity.label(),
"suppressed_by": f.suppressed_by,
}),
);
if let Some(id) = source {
msg = msg.with_source_paragraph(id);
}
crate::pane::output::emit(&msg);
}