lab_resource_manager/domain/aggregates/identity_link/value_objects/
external_system.rs1use serde::{Deserialize, Serialize};
2use std::str::FromStr;
3
4#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
6#[serde(rename_all = "lowercase")]
7pub enum ExternalSystem {
8 Slack,
9}
10
11impl ExternalSystem {
12 pub fn as_str(&self) -> &str {
13 match self {
14 ExternalSystem::Slack => "slack",
15 }
16 }
17}
18
19impl FromStr for ExternalSystem {
20 type Err = String;
21
22 fn from_str(s: &str) -> Result<Self, Self::Err> {
23 match s.to_lowercase().as_str() {
24 "slack" => Ok(ExternalSystem::Slack),
25 _ => Err(format!("Unknown external system: {}", s)),
26 }
27 }
28}