use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct IntentParseResult {
pub clean_intent: String,
pub skill_categories: Vec<String>,
}
impl IntentParseResult {
pub fn empty() -> Self {
Self {
clean_intent: String::new(),
skill_categories: Vec::new(),
}
}
pub fn fallback(original_input: &str) -> Self {
Self {
clean_intent: original_input.to_string(),
skill_categories: Vec::new(),
}
}
pub fn is_valid(&self) -> bool {
!self.clean_intent.is_empty()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_intent_parse_result_empty() {
let result = IntentParseResult::empty();
assert!(result.clean_intent.is_empty());
assert!(result.skill_categories.is_empty());
assert!(!result.is_valid());
}
}