use serde::{Deserialize, Serialize};
#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize, Deserialize)]
pub enum Certainty {
Observed,
#[serde(alias = "Very Likely")]
Likely,
Possible,
Unlikely,
Unknown,
}
impl Certainty {
pub fn name(&self) -> &'static str {
match self {
Certainty::Observed => "Observed",
Certainty::Likely => "Likely",
Certainty::Possible => "Possible",
Certainty::Unlikely => "Unlikely",
Certainty::Unknown => "Unknown",
}
}
pub fn description(&self) -> &'static str {
match self {
Certainty::Observed => "Determined to have occurred or to be ongoing",
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())
}
}
impl From<crate::v1dot0::Certainty> for Certainty {
fn from(value: crate::v1dot0::Certainty) -> Self {
use crate::v1dot0::Certainty as V1dot0;
match value {
V1dot0::VeryLikely => Certainty::Likely,
V1dot0::Likely => Certainty::Likely,
V1dot0::Possible => Certainty::Possible,
V1dot0::Unlikely => Certainty::Unlikely,
V1dot0::Unknown => Certainty::Unknown,
}
}
}