use ruma_macros::StringEnum;
use serde::{Deserialize, Serialize};
use crate::PrivOwnedStr;
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Focus {
Livekit(LivekitFocus),
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
pub struct LivekitFocus {
#[serde(rename = "livekit_alias")]
pub alias: String,
#[serde(rename = "livekit_service_url")]
pub service_url: String,
}
impl LivekitFocus {
pub fn new(alias: String, service_url: String) -> Self {
Self { alias, service_url }
}
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum ActiveFocus {
Livekit(ActiveLivekitFocus),
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
pub struct ActiveLivekitFocus {
pub focus_selection: FocusSelection,
}
impl ActiveLivekitFocus {
pub fn new() -> Self {
Self { focus_selection: FocusSelection::OldestMembership }
}
}
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
#[derive(Clone, StringEnum)]
#[ruma_enum(rename_all = "snake_case")]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
pub enum FocusSelection {
OldestMembership,
#[doc(hidden)]
_Custom(PrivOwnedStr),
}