use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Channel {
pub name: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}
impl Channel {
#[must_use]
pub fn new(name: impl Into<String>, description: Option<impl Into<String>>) -> Self {
Self {
name: name.into(),
description: description.map(Into::into),
}
}
#[must_use]
pub fn topic_seed(&self) -> String {
format!("syncweb/editorial/{}/v1", self.name)
}
#[must_use]
pub const fn accepts_all(&self) -> bool {
true
}
}