use crate::types::AutoHandoffConfig;
pub fn parse_auto_handoff_config(config_toml: &str) -> AutoHandoffConfig {
let mut config = AutoHandoffConfig::default();
if let Ok(table) = config_toml.parse::<toml::Value>() {
if let Some(tui) = table.get("tui").and_then(|v| v.as_table()) {
if let Some(ah) = tui.get("auto_handoff").and_then(|v| v.as_table()) {
if let Some(enabled) = ah.get("enabled").and_then(|v| v.as_bool()) {
config.enabled = enabled;
}
if let Some(threshold) = ah.get("context_threshold").and_then(|v| v.as_integer()) {
config.context_threshold = threshold as usize;
}
}
}
}
config
}