use serde::{Deserialize, Serialize};
#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub enum Certainty {
#[serde(rename = "Very Likely")]
VeryLikely,
Likely,
Possible,
Unlikely,
Unknown,
}
impl Certainty {
pub fn name(&self) -> &'static str {
match self {
Certainty::VeryLikely => "Very Likely",
Certainty::Likely => "Likely",
Certainty::Possible => "Possible",
Certainty::Unlikely => "Unlikely",
Certainty::Unknown => "Unknown",
}
}
pub fn description(&self) -> &'static str {
match self {
Certainty::VeryLikely => "Highly likely (p > ~ 85%) or certain",
Certainty::Likely => "Likely (p > ~50%)",
Certainty::Possible => "Possible but not likely (p <= ~50%)",
Certainty::Unlikely => "Not expected to occur (p ~ 0)",
Certainty::Unknown => "Certainty unknown",
}
}
}
impl std::fmt::Display for Certainty {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.name())
}
}