use crate::error::DatError;
use std::str::FromStr;
use strum_macros::Display;

#[repr(u8)]
#[derive(Debug, Display, Clone, Copy, Eq, PartialEq)]
pub enum CryptoAlgorithm {
    AES128GCMN,
    AES256GCMN,
}

impl FromStr for CryptoAlgorithm {
    type Err = DatError;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "AES128GCMN" => Ok(CryptoAlgorithm::AES128GCMN),
            "AES256GCMN" => Ok(CryptoAlgorithm::AES256GCMN),
            _ => Err(DatError::UnknownCryptoAlgorithm),
        }
    }
}
