#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CategorizationMethod {
Rule,
MerchantDict,
Ml,
Llm,
Default,
Manual,
}
impl CategorizationMethod {
#[must_use]
pub const fn as_meta_value(&self) -> &'static str {
match self {
Self::Rule => "rule",
Self::MerchantDict => "merchant-dict",
Self::Ml => "ml",
Self::Llm => "llm",
Self::Default => "default",
Self::Manual => "manual",
}
}
}
#[derive(Debug, Clone)]
pub struct Alternative {
pub account: String,
pub confidence: f64,
pub method: CategorizationMethod,
}
#[derive(Debug, Clone)]
pub struct Enrichment {
pub directive_index: usize,
pub confidence: f64,
pub method: CategorizationMethod,
pub alternatives: Vec<Alternative>,
pub fingerprint: Option<crate::fingerprint::Fingerprint>,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn categorization_method_meta_values() {
assert_eq!(CategorizationMethod::Rule.as_meta_value(), "rule");
assert_eq!(
CategorizationMethod::MerchantDict.as_meta_value(),
"merchant-dict"
);
assert_eq!(CategorizationMethod::Ml.as_meta_value(), "ml");
assert_eq!(CategorizationMethod::Llm.as_meta_value(), "llm");
assert_eq!(CategorizationMethod::Default.as_meta_value(), "default");
assert_eq!(CategorizationMethod::Manual.as_meta_value(), "manual");
}
}