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 _ => eyre::bail!("Invalid verification type"),
24 }
25 }
26}
27
28impl fmt::Display for VerificationType {
29 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30 match self {
31 Self::Full => write!(f, "full"),
32 Self::Partial => write!(f, "partial"),
33 }
34 }
35}