use crate::supports::enums;
use serde::{Deserialize, Serialize};
use std::fmt::Display;

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum DecisionEntryType {
    Email,
    TaxId,
    Name,
    BinLast4,
    #[serde(rename = "zip")]
    ZipCode,
    Ip,
    Device,
    Phone,
}

impl DecisionEntryType {
    pub fn name(&self) -> String {
        enums::to_string_infallible(self)
    }
}

impl Display for DecisionEntryType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.name())
    }
}
