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 pub alias: String,
27
28 #[serde(rename = "livekit_service_url")]
30 pub service_url: String,
31}
32
33impl LivekitFocus {
34 pub fn new(alias: String, service_url: String) -> Self {
41 Self { alias, service_url }
42 }
43}
44
45#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
50#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
51#[serde(tag = "type", rename_all = "snake_case")]
52pub enum ActiveFocus {
53 Livekit(ActiveLivekitFocus),
55}
56
57#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
59#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
60pub struct ActiveLivekitFocus {
61 pub focus_selection: FocusSelection,
63}
64
65impl ActiveLivekitFocus {
66 pub fn new() -> Self {
73 Self { focus_selection: FocusSelection::OldestMembership }
74 }
75}
76
77#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
79#[derive(Clone, PartialEq, StringEnum)]
80#[ruma_enum(rename_all = "snake_case")]
81#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
82pub enum FocusSelection {
83 OldestMembership,
85
86 #[doc(hidden)]
87 _Custom(PrivOwnedStr),
88}