pub const AUTH: &str = "auth";
pub const AUTH_OK: &str = "auth.ok";
pub const AUTH_FAILED: &str = "auth.failed";
pub const CHAT_JOIN: &str = "chat.join";
pub const CHAT_LEAVE: &str = "chat.leave";
pub const CHAT_SEND: &str = "chat.send";
pub const CHAT_HISTORY: &str = "chat.history";
pub const CHAT_MESSAGE: &str = "chat.message";
pub const CHAT_DELETED: &str = "chat.deleted";
pub const CHAT_MEMBERS: &str = "chat.members";
pub const CHAT_PRESENCE: &str = "chat.presence";
pub fn is_reserved(kind: &str) -> bool {
matches!(kind, AUTH | AUTH_OK | AUTH_FAILED)
}
pub const ALL: &[&str] = &[AUTH, AUTH_OK, AUTH_FAILED, CHAT_JOIN, CHAT_LEAVE, CHAT_SEND, CHAT_HISTORY, CHAT_MESSAGE, CHAT_DELETED, CHAT_MEMBERS, CHAT_PRESENCE];
#[cfg(test)]
mod tests {
#[test]
fn kinds_are_unique_and_lowercase() {
let mut seen = std::collections::HashSet::new();
for kind in super::ALL {
assert!(seen.insert(*kind), "duplicate {kind}");
assert!(kind.bytes().all(|b| b.is_ascii_lowercase() || b == b'.' || b == b'_'), "{kind}");
}
assert!(super::is_reserved("auth.ok") && !super::is_reserved("chat.message"));
}
}