use crate::split_keyword;
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct Tca {
pub identifier: String,
pub enabled: Option<bool>,
pub threshold: Option<String>,
pub threshold_24hrs: Option<String>,
}
pub(super) fn parse_tca(arg: &str) -> Tca {
let (identifier, rest) = split_keyword(arg);
let words: Vec<&str> = rest.split_whitespace().collect();
let enabled = if words.contains(&"enable-tca") {
Some(true)
} else if words.contains(&"no-enable-tca") {
Some(false)
} else {
None
};
Tca {
identifier: identifier.to_string(),
enabled,
threshold: crate::value_after(&words, "threshold"),
threshold_24hrs: crate::value_after(&words, "threshold-24hrs"),
}
}