use serde::{Deserialize, Serialize};
use strum::{AsRefStr, EnumIter, EnumString, IntoEnumIterator};

#[derive(PartialEq, EnumIter, EnumString, AsRefStr, Deserialize, Serialize, Debug, Clone)]
pub enum UserRole {
    Viewer,
    Admin,
}

pub fn all() -> Vec<UserRole> {
    UserRole::iter().collect()
}

impl From<String> for UserRole {
    fn from(value: String) -> Self {
        value.parse().unwrap()
    }
}
