ruma_events/call/member/
focus.rs1use ruma_macros::StringEnum;
4use serde::{Deserialize, Serialize};
5
6use crate::PrivOwnedStr;
7
8#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
13#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
14#[serde(tag = "type", rename_all = "snake_case")]
15pub enum Focus {
16 Livekit(LivekitFocus),
18}
19
20#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
22#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
23pub struct LivekitFocus {
24 #[serde(rename = "livekit_alias")]
26 #[deprecated = "Newer versions of Element Call won't fill this field anymore."]
27 pub alias: Option<String>,
28
29 #[serde(rename = "livekit_service_url")]
31 pub service_url: String,
32}
33
34impl LivekitFocus {
35 #[allow(deprecated)]
42 pub fn new(alias: Option<String>, service_url: String) -> Self {
43 Self { alias, service_url }
44 }
45}
46
47#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
52#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
53#[serde(tag = "type", rename_all = "snake_case")]
54pub enum ActiveFocus {
55 Livekit(ActiveLivekitFocus),
57}
58
59#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
61#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
62pub struct ActiveLivekitFocus {
63 pub focus_selection: FocusSelection,
65}
66
67impl ActiveLivekitFocus {
68 pub fn new() -> Self {
75 Self { focus_selection: FocusSelection::OldestMembership }
76 }
77}
78
79#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
81#[derive(Clone, StringEnum)]
82#[ruma_enum(rename_all = "snake_case")]
83#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
84pub enum FocusSelection {
85 OldestMembership,
87
88 #[doc(hidden)]
89 _Custom(PrivOwnedStr),
90}