1use eyre::Result;
2use serde::{Deserialize, Serialize};
3use std::{fmt, str::FromStr};
4
5#[derive(Debug, Clone, clap::ValueEnum, Default, PartialEq, Eq, Serialize, Deserialize, Copy)]
8pub enum VerificationType {
9 #[default]
10 #[serde(rename = "full")]
11 Full,
12 #[serde(rename = "partial")]
13 Partial,
14}
15
16impl FromStr for VerificationType {
17 type Err = eyre::Error;
18
19 fn from_str(s: &str) -> Result<Self> {
20 match s {
21 "full" => Ok(Self::Full),
22 "partial" => Ok(Self::Partial),
23 _ => {
24 eyre::bail!("Invalid verification type");
25 }
26 }
27 }
28}
29
30impl fmt::Display for VerificationType {
31 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32 match self {
33 Self::Full => write!(f, "full"),
34 Self::Partial => write!(f, "partial"),
35 }
36 }
37}