use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, ToSchema)]
pub struct ValorServiceId(pub String);
impl ValorServiceId {
pub const RIGH_DEVICE_CLASSIFICATION: &'static str = "righ.device_classification";
pub const COMMON_CMD: &'static str = "common.cmd";
#[allow(unused)]
pub fn righ_device_classification() -> Self {
Self(Self::RIGH_DEVICE_CLASSIFICATION.to_string())
}
#[allow(unused)]
pub fn common_cmd() -> Self {
Self(Self::COMMON_CMD.to_string())
}
#[allow(unused)]
pub fn as_str(&self) -> &str {
&self.0
}
}
impl<T: Into<String>> From<T> for ValorServiceId {
fn from(value: T) -> Self {
Self(value.into())
}
}
impl std::fmt::Display for ValorServiceId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl AsRef<str> for ValorServiceId {
fn as_ref(&self) -> &str {
&self.0
}
}