Skip to main content

simploxide_api_types/
lib.rs

1//! This crate is auto-generated
2
3#![allow(clippy::large_enum_variant)]
4#![allow(clippy::new_without_default)]
5#![allow(clippy::should_implement_trait)]
6#![allow(clippy::unnecessary_to_owned)]
7
8pub mod client_api;
9pub mod commands;
10pub mod errors;
11pub mod events;
12pub mod responses;
13pub mod utils;
14
15use errors::*;
16use serde::{Deserialize, Serialize};
17use serde_aux::field_attributes::{
18    deserialize_number_from_string, deserialize_option_number_from_string,
19};
20use std::{collections::BTreeMap, fmt::Write as _, sync::Arc};
21use utils::CommandSyntax;
22
23pub type UtcTime = String;
24pub type JsonObject = serde_json::Value;
25
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27#[cfg_attr(feature = "bon", derive(::bon::Builder))]
28#[cfg_attr(feature = "bon", builder(on(String, into)))]
29pub struct ACIReaction {
30    #[serde(rename = "chatInfo")]
31    pub chat_info: ChatInfo,
32
33    #[serde(rename = "chatReaction")]
34    pub chat_reaction: CIReaction,
35
36    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
37    #[cfg_attr(feature = "bon", builder(default))]
38    pub undocumented: JsonObject,
39}
40
41#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
42#[cfg_attr(feature = "bon", derive(::bon::Builder))]
43#[cfg_attr(feature = "bon", builder(on(String, into)))]
44pub struct AChat {
45    #[serde(rename = "chatInfo")]
46    pub chat_info: ChatInfo,
47
48    #[serde(rename = "chatItems")]
49    pub chat_items: Vec<ChatItem>,
50
51    #[serde(rename = "chatStats")]
52    pub chat_stats: ChatStats,
53
54    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
55    #[cfg_attr(feature = "bon", builder(default))]
56    pub undocumented: JsonObject,
57}
58
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
60#[cfg_attr(feature = "bon", derive(::bon::Builder))]
61#[cfg_attr(feature = "bon", builder(on(String, into)))]
62pub struct AChatItem {
63    #[serde(rename = "chatInfo")]
64    pub chat_info: ChatInfo,
65
66    #[serde(rename = "chatItem")]
67    pub chat_item: ChatItem,
68
69    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
70    #[cfg_attr(feature = "bon", builder(default))]
71    pub undocumented: JsonObject,
72}
73
74#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
75#[cfg_attr(feature = "bon", derive(::bon::Builder))]
76#[cfg_attr(feature = "bon", builder(on(String, into)))]
77pub struct AddRelayResult {
78    #[serde(rename = "relay")]
79    pub relay: UserChatRelay,
80
81    #[serde(rename = "relayError", skip_serializing_if = "Option::is_none")]
82    pub relay_error: Option<ChatError>,
83
84    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
85    #[cfg_attr(feature = "bon", builder(default))]
86    pub undocumented: JsonObject,
87}
88
89#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
90#[cfg_attr(feature = "bon", derive(::bon::Builder))]
91#[cfg_attr(feature = "bon", builder(on(String, into)))]
92pub struct AddressSettings {
93    #[serde(rename = "businessAddress", default)]
94    pub business_address: bool,
95
96    #[serde(rename = "autoAccept", skip_serializing_if = "Option::is_none")]
97    pub auto_accept: Option<AutoAccept>,
98
99    #[serde(rename = "autoReply", skip_serializing_if = "Option::is_none")]
100    pub auto_reply: Option<MsgContent>,
101
102    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
103    #[cfg_attr(feature = "bon", builder(default))]
104    pub undocumented: JsonObject,
105}
106
107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
108#[cfg_attr(feature = "bon", derive(::bon::Builder))]
109#[cfg_attr(feature = "bon", builder(on(String, into)))]
110pub struct AutoAccept {
111    #[serde(rename = "acceptIncognito", default)]
112    pub accept_incognito: bool,
113
114    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
115    #[cfg_attr(feature = "bon", builder(default))]
116    pub undocumented: JsonObject,
117}
118
119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
120#[cfg_attr(feature = "bon", derive(::bon::Builder))]
121#[cfg_attr(feature = "bon", builder(on(String, into)))]
122pub struct BlockingInfo {
123    #[serde(rename = "reason")]
124    pub reason: BlockingReason,
125
126    #[serde(rename = "notice", skip_serializing_if = "Option::is_none")]
127    pub notice: Option<ClientNotice>,
128
129    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
130    #[cfg_attr(feature = "bon", builder(default))]
131    pub undocumented: JsonObject,
132}
133
134#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
135#[non_exhaustive]
136pub enum BlockingReason {
137    #[default]
138    #[serde(rename = "spam")]
139    Spam,
140    #[serde(rename = "content")]
141    Content,
142}
143
144#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
145#[cfg_attr(feature = "bon", derive(::bon::Builder))]
146#[cfg_attr(feature = "bon", builder(on(String, into)))]
147pub struct BusinessChatInfo {
148    #[serde(rename = "chatType")]
149    pub chat_type: BusinessChatType,
150
151    #[serde(rename = "businessId")]
152    pub business_id: String,
153
154    #[serde(rename = "customerId")]
155    pub customer_id: String,
156
157    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
158    #[cfg_attr(feature = "bon", builder(default))]
159    pub undocumented: JsonObject,
160}
161
162#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
163#[non_exhaustive]
164pub enum BusinessChatType {
165    #[default]
166    #[serde(rename = "business")]
167    Business,
168    #[serde(rename = "customer")]
169    Customer,
170}
171
172#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
173#[non_exhaustive]
174pub enum CICallStatus {
175    #[default]
176    #[serde(rename = "pending")]
177    Pending,
178    #[serde(rename = "missed")]
179    Missed,
180    #[serde(rename = "rejected")]
181    Rejected,
182    #[serde(rename = "accepted")]
183    Accepted,
184    #[serde(rename = "negotiated")]
185    Negotiated,
186    #[serde(rename = "progress")]
187    Progress,
188    #[serde(rename = "ended")]
189    Ended,
190    #[serde(rename = "error")]
191    Error,
192}
193
194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
195#[serde(tag = "type")]
196#[non_exhaustive]
197pub enum CIContent {
198    #[serde(rename = "sndMsgContent")]
199    SndMsgContent {
200        #[serde(rename = "msgContent")]
201        msg_content: MsgContent,
202
203        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
204        undocumented: JsonObject,
205    },
206    #[serde(rename = "rcvMsgContent")]
207    RcvMsgContent {
208        #[serde(rename = "msgContent")]
209        msg_content: MsgContent,
210
211        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
212        undocumented: JsonObject,
213    },
214    #[serde(rename = "sndDeleted")]
215    SndDeleted {
216        #[serde(rename = "deleteMode")]
217        delete_mode: CIDeleteMode,
218
219        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
220        undocumented: JsonObject,
221    },
222    #[serde(rename = "rcvDeleted")]
223    RcvDeleted {
224        #[serde(rename = "deleteMode")]
225        delete_mode: CIDeleteMode,
226
227        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
228        undocumented: JsonObject,
229    },
230    #[serde(rename = "sndCall")]
231    SndCall {
232        #[serde(rename = "status")]
233        status: CICallStatus,
234
235        #[serde(
236            rename = "duration",
237            deserialize_with = "deserialize_number_from_string"
238        )]
239        duration: i32,
240
241        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
242        undocumented: JsonObject,
243    },
244    #[serde(rename = "rcvCall")]
245    RcvCall {
246        #[serde(rename = "status")]
247        status: CICallStatus,
248
249        #[serde(
250            rename = "duration",
251            deserialize_with = "deserialize_number_from_string"
252        )]
253        duration: i32,
254
255        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
256        undocumented: JsonObject,
257    },
258    #[serde(rename = "rcvIntegrityError")]
259    RcvIntegrityError {
260        #[serde(rename = "msgError")]
261        msg_error: MsgErrorType,
262
263        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
264        undocumented: JsonObject,
265    },
266    #[serde(rename = "rcvDecryptionError")]
267    RcvDecryptionError {
268        #[serde(rename = "msgDecryptError")]
269        msg_decrypt_error: MsgDecryptError,
270
271        #[serde(
272            rename = "msgCount",
273            deserialize_with = "deserialize_number_from_string"
274        )]
275        msg_count: u32,
276
277        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
278        undocumented: JsonObject,
279    },
280    #[serde(rename = "rcvMsgError")]
281    RcvMsgError {
282        #[serde(rename = "rcvMsgError")]
283        rcv_msg_error: RcvMsgError,
284
285        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
286        undocumented: JsonObject,
287    },
288    #[serde(rename = "rcvGroupInvitation")]
289    RcvGroupInvitation {
290        #[serde(rename = "groupInvitation")]
291        group_invitation: CIGroupInvitation,
292
293        #[serde(rename = "memberRole")]
294        member_role: GroupMemberRole,
295
296        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
297        undocumented: JsonObject,
298    },
299    #[serde(rename = "sndGroupInvitation")]
300    SndGroupInvitation {
301        #[serde(rename = "groupInvitation")]
302        group_invitation: CIGroupInvitation,
303
304        #[serde(rename = "memberRole")]
305        member_role: GroupMemberRole,
306
307        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
308        undocumented: JsonObject,
309    },
310    #[serde(rename = "rcvDirectEvent")]
311    RcvDirectEvent {
312        #[serde(rename = "rcvDirectEvent")]
313        rcv_direct_event: RcvDirectEvent,
314
315        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
316        undocumented: JsonObject,
317    },
318    #[serde(rename = "rcvGroupEvent")]
319    RcvGroupEvent {
320        #[serde(rename = "rcvGroupEvent")]
321        rcv_group_event: RcvGroupEvent,
322
323        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
324        undocumented: JsonObject,
325    },
326    #[serde(rename = "sndGroupEvent")]
327    SndGroupEvent {
328        #[serde(rename = "sndGroupEvent")]
329        snd_group_event: SndGroupEvent,
330
331        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
332        undocumented: JsonObject,
333    },
334    #[serde(rename = "rcvConnEvent")]
335    RcvConnEvent {
336        #[serde(rename = "rcvConnEvent")]
337        rcv_conn_event: RcvConnEvent,
338
339        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
340        undocumented: JsonObject,
341    },
342    #[serde(rename = "sndConnEvent")]
343    SndConnEvent {
344        #[serde(rename = "sndConnEvent")]
345        snd_conn_event: SndConnEvent,
346
347        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
348        undocumented: JsonObject,
349    },
350    #[serde(rename = "rcvChatFeature")]
351    RcvChatFeature {
352        #[serde(rename = "feature")]
353        feature: ChatFeature,
354
355        #[serde(rename = "enabled")]
356        enabled: PrefEnabled,
357
358        #[serde(
359            rename = "param",
360            skip_serializing_if = "Option::is_none",
361            deserialize_with = "deserialize_option_number_from_string",
362            default
363        )]
364        param: Option<i32>,
365
366        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
367        undocumented: JsonObject,
368    },
369    #[serde(rename = "sndChatFeature")]
370    SndChatFeature {
371        #[serde(rename = "feature")]
372        feature: ChatFeature,
373
374        #[serde(rename = "enabled")]
375        enabled: PrefEnabled,
376
377        #[serde(
378            rename = "param",
379            skip_serializing_if = "Option::is_none",
380            deserialize_with = "deserialize_option_number_from_string",
381            default
382        )]
383        param: Option<i32>,
384
385        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
386        undocumented: JsonObject,
387    },
388    #[serde(rename = "rcvChatPreference")]
389    RcvChatPreference {
390        #[serde(rename = "feature")]
391        feature: ChatFeature,
392
393        #[serde(rename = "allowed")]
394        allowed: FeatureAllowed,
395
396        #[serde(
397            rename = "param",
398            skip_serializing_if = "Option::is_none",
399            deserialize_with = "deserialize_option_number_from_string",
400            default
401        )]
402        param: Option<i32>,
403
404        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
405        undocumented: JsonObject,
406    },
407    #[serde(rename = "sndChatPreference")]
408    SndChatPreference {
409        #[serde(rename = "feature")]
410        feature: ChatFeature,
411
412        #[serde(rename = "allowed")]
413        allowed: FeatureAllowed,
414
415        #[serde(
416            rename = "param",
417            skip_serializing_if = "Option::is_none",
418            deserialize_with = "deserialize_option_number_from_string",
419            default
420        )]
421        param: Option<i32>,
422
423        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
424        undocumented: JsonObject,
425    },
426    #[serde(rename = "rcvGroupFeature")]
427    RcvGroupFeature {
428        #[serde(rename = "groupFeature")]
429        group_feature: GroupFeature,
430
431        #[serde(rename = "preference")]
432        preference: GroupPreference,
433
434        #[serde(
435            rename = "param",
436            skip_serializing_if = "Option::is_none",
437            deserialize_with = "deserialize_option_number_from_string",
438            default
439        )]
440        param: Option<i32>,
441
442        #[serde(rename = "memberRole_", skip_serializing_if = "Option::is_none")]
443        member_role: Option<GroupMemberRole>,
444
445        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
446        undocumented: JsonObject,
447    },
448    #[serde(rename = "sndGroupFeature")]
449    SndGroupFeature {
450        #[serde(rename = "groupFeature")]
451        group_feature: GroupFeature,
452
453        #[serde(rename = "preference")]
454        preference: GroupPreference,
455
456        #[serde(
457            rename = "param",
458            skip_serializing_if = "Option::is_none",
459            deserialize_with = "deserialize_option_number_from_string",
460            default
461        )]
462        param: Option<i32>,
463
464        #[serde(rename = "memberRole_", skip_serializing_if = "Option::is_none")]
465        member_role: Option<GroupMemberRole>,
466
467        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
468        undocumented: JsonObject,
469    },
470    #[serde(rename = "rcvChatFeatureRejected")]
471    RcvChatFeatureRejected {
472        #[serde(rename = "feature")]
473        feature: ChatFeature,
474
475        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
476        undocumented: JsonObject,
477    },
478    #[serde(rename = "rcvGroupFeatureRejected")]
479    RcvGroupFeatureRejected {
480        #[serde(rename = "groupFeature")]
481        group_feature: GroupFeature,
482
483        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
484        undocumented: JsonObject,
485    },
486    #[serde(rename = "sndModerated")]
487    SndModerated,
488    #[serde(rename = "rcvModerated")]
489    RcvModerated,
490    #[serde(rename = "rcvBlocked")]
491    RcvBlocked,
492    #[serde(rename = "sndDirectE2EEInfo")]
493    SndDirectE2EeInfo {
494        #[serde(rename = "e2eeInfo")]
495        e_2_ee_info: E2EInfo,
496
497        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
498        undocumented: JsonObject,
499    },
500    #[serde(rename = "rcvDirectE2EEInfo")]
501    RcvDirectE2EeInfo {
502        #[serde(rename = "e2eeInfo")]
503        e_2_ee_info: E2EInfo,
504
505        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
506        undocumented: JsonObject,
507    },
508    #[serde(rename = "sndGroupE2EEInfo")]
509    SndGroupE2EeInfo {
510        #[serde(rename = "e2eeInfo")]
511        e_2_ee_info: E2EInfo,
512
513        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
514        undocumented: JsonObject,
515    },
516    #[serde(rename = "rcvGroupE2EEInfo")]
517    RcvGroupE2EeInfo {
518        #[serde(rename = "e2eeInfo")]
519        e_2_ee_info: E2EInfo,
520
521        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
522        undocumented: JsonObject,
523    },
524    #[serde(rename = "chatBanner")]
525    ChatBanner,
526    #[serde(untagged)]
527    Undocumented(JsonObject),
528}
529
530impl CIContent {
531    pub fn make_snd_msg_content(msg_content: MsgContent) -> Self {
532        Self::SndMsgContent {
533            msg_content,
534            undocumented: Default::default(),
535        }
536    }
537
538    pub fn make_rcv_msg_content(msg_content: MsgContent) -> Self {
539        Self::RcvMsgContent {
540            msg_content,
541            undocumented: Default::default(),
542        }
543    }
544
545    pub fn make_snd_deleted(delete_mode: CIDeleteMode) -> Self {
546        Self::SndDeleted {
547            delete_mode,
548            undocumented: Default::default(),
549        }
550    }
551
552    pub fn make_rcv_deleted(delete_mode: CIDeleteMode) -> Self {
553        Self::RcvDeleted {
554            delete_mode,
555            undocumented: Default::default(),
556        }
557    }
558
559    pub fn make_snd_call(status: CICallStatus, duration: i32) -> Self {
560        Self::SndCall {
561            status,
562            duration,
563            undocumented: Default::default(),
564        }
565    }
566
567    pub fn make_rcv_call(status: CICallStatus, duration: i32) -> Self {
568        Self::RcvCall {
569            status,
570            duration,
571            undocumented: Default::default(),
572        }
573    }
574
575    pub fn make_rcv_integrity_error(msg_error: MsgErrorType) -> Self {
576        Self::RcvIntegrityError {
577            msg_error,
578            undocumented: Default::default(),
579        }
580    }
581
582    pub fn make_rcv_decryption_error(msg_decrypt_error: MsgDecryptError, msg_count: u32) -> Self {
583        Self::RcvDecryptionError {
584            msg_decrypt_error,
585            msg_count,
586            undocumented: Default::default(),
587        }
588    }
589
590    pub fn make_rcv_msg_error(rcv_msg_error: RcvMsgError) -> Self {
591        Self::RcvMsgError {
592            rcv_msg_error,
593            undocumented: Default::default(),
594        }
595    }
596
597    pub fn make_rcv_group_invitation(
598        group_invitation: CIGroupInvitation,
599        member_role: GroupMemberRole,
600    ) -> Self {
601        Self::RcvGroupInvitation {
602            group_invitation,
603            member_role,
604            undocumented: Default::default(),
605        }
606    }
607
608    pub fn make_snd_group_invitation(
609        group_invitation: CIGroupInvitation,
610        member_role: GroupMemberRole,
611    ) -> Self {
612        Self::SndGroupInvitation {
613            group_invitation,
614            member_role,
615            undocumented: Default::default(),
616        }
617    }
618
619    pub fn make_rcv_direct_event(rcv_direct_event: RcvDirectEvent) -> Self {
620        Self::RcvDirectEvent {
621            rcv_direct_event,
622            undocumented: Default::default(),
623        }
624    }
625
626    pub fn make_rcv_group_event(rcv_group_event: RcvGroupEvent) -> Self {
627        Self::RcvGroupEvent {
628            rcv_group_event,
629            undocumented: Default::default(),
630        }
631    }
632
633    pub fn make_snd_group_event(snd_group_event: SndGroupEvent) -> Self {
634        Self::SndGroupEvent {
635            snd_group_event,
636            undocumented: Default::default(),
637        }
638    }
639
640    pub fn make_rcv_conn_event(rcv_conn_event: RcvConnEvent) -> Self {
641        Self::RcvConnEvent {
642            rcv_conn_event,
643            undocumented: Default::default(),
644        }
645    }
646
647    pub fn make_snd_conn_event(snd_conn_event: SndConnEvent) -> Self {
648        Self::SndConnEvent {
649            snd_conn_event,
650            undocumented: Default::default(),
651        }
652    }
653
654    pub fn make_rcv_chat_feature(
655        feature: ChatFeature,
656        enabled: PrefEnabled,
657        param: Option<i32>,
658    ) -> Self {
659        Self::RcvChatFeature {
660            feature,
661            enabled,
662            param,
663            undocumented: Default::default(),
664        }
665    }
666
667    pub fn make_snd_chat_feature(
668        feature: ChatFeature,
669        enabled: PrefEnabled,
670        param: Option<i32>,
671    ) -> Self {
672        Self::SndChatFeature {
673            feature,
674            enabled,
675            param,
676            undocumented: Default::default(),
677        }
678    }
679
680    pub fn make_rcv_chat_preference(
681        feature: ChatFeature,
682        allowed: FeatureAllowed,
683        param: Option<i32>,
684    ) -> Self {
685        Self::RcvChatPreference {
686            feature,
687            allowed,
688            param,
689            undocumented: Default::default(),
690        }
691    }
692
693    pub fn make_snd_chat_preference(
694        feature: ChatFeature,
695        allowed: FeatureAllowed,
696        param: Option<i32>,
697    ) -> Self {
698        Self::SndChatPreference {
699            feature,
700            allowed,
701            param,
702            undocumented: Default::default(),
703        }
704    }
705
706    pub fn make_rcv_group_feature(
707        group_feature: GroupFeature,
708        preference: GroupPreference,
709        param: Option<i32>,
710        member_role: Option<GroupMemberRole>,
711    ) -> Self {
712        Self::RcvGroupFeature {
713            group_feature,
714            preference,
715            param,
716            member_role,
717            undocumented: Default::default(),
718        }
719    }
720
721    pub fn make_snd_group_feature(
722        group_feature: GroupFeature,
723        preference: GroupPreference,
724        param: Option<i32>,
725        member_role: Option<GroupMemberRole>,
726    ) -> Self {
727        Self::SndGroupFeature {
728            group_feature,
729            preference,
730            param,
731            member_role,
732            undocumented: Default::default(),
733        }
734    }
735
736    pub fn make_rcv_chat_feature_rejected(feature: ChatFeature) -> Self {
737        Self::RcvChatFeatureRejected {
738            feature,
739            undocumented: Default::default(),
740        }
741    }
742
743    pub fn make_rcv_group_feature_rejected(group_feature: GroupFeature) -> Self {
744        Self::RcvGroupFeatureRejected {
745            group_feature,
746            undocumented: Default::default(),
747        }
748    }
749
750    pub fn make_snd_moderated() -> Self {
751        Self::SndModerated
752    }
753
754    pub fn make_rcv_moderated() -> Self {
755        Self::RcvModerated
756    }
757
758    pub fn make_rcv_blocked() -> Self {
759        Self::RcvBlocked
760    }
761
762    pub fn make_snd_direct_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
763        Self::SndDirectE2EeInfo {
764            e_2_ee_info,
765            undocumented: Default::default(),
766        }
767    }
768
769    pub fn make_rcv_direct_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
770        Self::RcvDirectE2EeInfo {
771            e_2_ee_info,
772            undocumented: Default::default(),
773        }
774    }
775
776    pub fn make_snd_group_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
777        Self::SndGroupE2EeInfo {
778            e_2_ee_info,
779            undocumented: Default::default(),
780        }
781    }
782
783    pub fn make_rcv_group_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
784        Self::RcvGroupE2EeInfo {
785            e_2_ee_info,
786            undocumented: Default::default(),
787        }
788    }
789
790    pub fn make_chat_banner() -> Self {
791        Self::ChatBanner
792    }
793}
794
795impl CIContent {
796    pub fn snd_msg_content(&self) -> Option<&MsgContent> {
797        if let Self::SndMsgContent { msg_content, .. } = self {
798            Some(msg_content)
799        } else {
800            None
801        }
802    }
803    pub fn rcv_msg_content(&self) -> Option<&MsgContent> {
804        if let Self::RcvMsgContent { msg_content, .. } = self {
805            Some(msg_content)
806        } else {
807            None
808        }
809    }
810    pub fn snd_deleted(&self) -> Option<&CIDeleteMode> {
811        if let Self::SndDeleted { delete_mode, .. } = self {
812            Some(delete_mode)
813        } else {
814            None
815        }
816    }
817    pub fn rcv_deleted(&self) -> Option<&CIDeleteMode> {
818        if let Self::RcvDeleted { delete_mode, .. } = self {
819            Some(delete_mode)
820        } else {
821            None
822        }
823    }
824    pub fn snd_call(&self) -> Option<CIContentSndCallRef<'_>> {
825        if let Self::SndCall {
826            status, duration, ..
827        } = self
828        {
829            Some(CIContentSndCallRef { status, duration })
830        } else {
831            None
832        }
833    }
834    pub fn rcv_call(&self) -> Option<CIContentRcvCallRef<'_>> {
835        if let Self::RcvCall {
836            status, duration, ..
837        } = self
838        {
839            Some(CIContentRcvCallRef { status, duration })
840        } else {
841            None
842        }
843    }
844    pub fn rcv_integrity_error(&self) -> Option<&MsgErrorType> {
845        if let Self::RcvIntegrityError { msg_error, .. } = self {
846            Some(msg_error)
847        } else {
848            None
849        }
850    }
851    pub fn rcv_decryption_error(&self) -> Option<CIContentRcvDecryptionErrorRef<'_>> {
852        if let Self::RcvDecryptionError {
853            msg_decrypt_error,
854            msg_count,
855            ..
856        } = self
857        {
858            Some(CIContentRcvDecryptionErrorRef {
859                msg_decrypt_error,
860                msg_count,
861            })
862        } else {
863            None
864        }
865    }
866    pub fn rcv_msg_error(&self) -> Option<&RcvMsgError> {
867        if let Self::RcvMsgError { rcv_msg_error, .. } = self {
868            Some(rcv_msg_error)
869        } else {
870            None
871        }
872    }
873    pub fn rcv_group_invitation(&self) -> Option<CIContentRcvGroupInvitationRef<'_>> {
874        if let Self::RcvGroupInvitation {
875            group_invitation,
876            member_role,
877            ..
878        } = self
879        {
880            Some(CIContentRcvGroupInvitationRef {
881                group_invitation,
882                member_role,
883            })
884        } else {
885            None
886        }
887    }
888    pub fn snd_group_invitation(&self) -> Option<CIContentSndGroupInvitationRef<'_>> {
889        if let Self::SndGroupInvitation {
890            group_invitation,
891            member_role,
892            ..
893        } = self
894        {
895            Some(CIContentSndGroupInvitationRef {
896                group_invitation,
897                member_role,
898            })
899        } else {
900            None
901        }
902    }
903    pub fn rcv_direct_event(&self) -> Option<&RcvDirectEvent> {
904        if let Self::RcvDirectEvent {
905            rcv_direct_event, ..
906        } = self
907        {
908            Some(rcv_direct_event)
909        } else {
910            None
911        }
912    }
913    pub fn rcv_group_event(&self) -> Option<&RcvGroupEvent> {
914        if let Self::RcvGroupEvent {
915            rcv_group_event, ..
916        } = self
917        {
918            Some(rcv_group_event)
919        } else {
920            None
921        }
922    }
923    pub fn snd_group_event(&self) -> Option<&SndGroupEvent> {
924        if let Self::SndGroupEvent {
925            snd_group_event, ..
926        } = self
927        {
928            Some(snd_group_event)
929        } else {
930            None
931        }
932    }
933    pub fn rcv_conn_event(&self) -> Option<&RcvConnEvent> {
934        if let Self::RcvConnEvent { rcv_conn_event, .. } = self {
935            Some(rcv_conn_event)
936        } else {
937            None
938        }
939    }
940    pub fn snd_conn_event(&self) -> Option<&SndConnEvent> {
941        if let Self::SndConnEvent { snd_conn_event, .. } = self {
942            Some(snd_conn_event)
943        } else {
944            None
945        }
946    }
947    pub fn rcv_chat_feature(&self) -> Option<CIContentRcvChatFeatureRef<'_>> {
948        if let Self::RcvChatFeature {
949            feature,
950            enabled,
951            param,
952            ..
953        } = self
954        {
955            Some(CIContentRcvChatFeatureRef {
956                feature,
957                enabled,
958                param,
959            })
960        } else {
961            None
962        }
963    }
964    pub fn snd_chat_feature(&self) -> Option<CIContentSndChatFeatureRef<'_>> {
965        if let Self::SndChatFeature {
966            feature,
967            enabled,
968            param,
969            ..
970        } = self
971        {
972            Some(CIContentSndChatFeatureRef {
973                feature,
974                enabled,
975                param,
976            })
977        } else {
978            None
979        }
980    }
981    pub fn rcv_chat_preference(&self) -> Option<CIContentRcvChatPreferenceRef<'_>> {
982        if let Self::RcvChatPreference {
983            feature,
984            allowed,
985            param,
986            ..
987        } = self
988        {
989            Some(CIContentRcvChatPreferenceRef {
990                feature,
991                allowed,
992                param,
993            })
994        } else {
995            None
996        }
997    }
998    pub fn snd_chat_preference(&self) -> Option<CIContentSndChatPreferenceRef<'_>> {
999        if let Self::SndChatPreference {
1000            feature,
1001            allowed,
1002            param,
1003            ..
1004        } = self
1005        {
1006            Some(CIContentSndChatPreferenceRef {
1007                feature,
1008                allowed,
1009                param,
1010            })
1011        } else {
1012            None
1013        }
1014    }
1015    pub fn rcv_group_feature(&self) -> Option<CIContentRcvGroupFeatureRef<'_>> {
1016        if let Self::RcvGroupFeature {
1017            group_feature,
1018            preference,
1019            param,
1020            member_role,
1021            ..
1022        } = self
1023        {
1024            Some(CIContentRcvGroupFeatureRef {
1025                group_feature,
1026                preference,
1027                param,
1028                member_role,
1029            })
1030        } else {
1031            None
1032        }
1033    }
1034    pub fn snd_group_feature(&self) -> Option<CIContentSndGroupFeatureRef<'_>> {
1035        if let Self::SndGroupFeature {
1036            group_feature,
1037            preference,
1038            param,
1039            member_role,
1040            ..
1041        } = self
1042        {
1043            Some(CIContentSndGroupFeatureRef {
1044                group_feature,
1045                preference,
1046                param,
1047                member_role,
1048            })
1049        } else {
1050            None
1051        }
1052    }
1053    pub fn rcv_chat_feature_rejected(&self) -> Option<&ChatFeature> {
1054        if let Self::RcvChatFeatureRejected { feature, .. } = self {
1055            Some(feature)
1056        } else {
1057            None
1058        }
1059    }
1060    pub fn rcv_group_feature_rejected(&self) -> Option<&GroupFeature> {
1061        if let Self::RcvGroupFeatureRejected { group_feature, .. } = self {
1062            Some(group_feature)
1063        } else {
1064            None
1065        }
1066    }
1067    pub fn is_snd_moderated(&self) -> bool {
1068        matches!(self, Self::SndModerated)
1069    }
1070    pub fn is_rcv_moderated(&self) -> bool {
1071        matches!(self, Self::RcvModerated)
1072    }
1073    pub fn is_rcv_blocked(&self) -> bool {
1074        matches!(self, Self::RcvBlocked)
1075    }
1076    pub fn snd_direct_e_2_ee_info(&self) -> Option<&E2EInfo> {
1077        if let Self::SndDirectE2EeInfo { e_2_ee_info, .. } = self {
1078            Some(e_2_ee_info)
1079        } else {
1080            None
1081        }
1082    }
1083    pub fn rcv_direct_e_2_ee_info(&self) -> Option<&E2EInfo> {
1084        if let Self::RcvDirectE2EeInfo { e_2_ee_info, .. } = self {
1085            Some(e_2_ee_info)
1086        } else {
1087            None
1088        }
1089    }
1090    pub fn snd_group_e_2_ee_info(&self) -> Option<&E2EInfo> {
1091        if let Self::SndGroupE2EeInfo { e_2_ee_info, .. } = self {
1092            Some(e_2_ee_info)
1093        } else {
1094            None
1095        }
1096    }
1097    pub fn rcv_group_e_2_ee_info(&self) -> Option<&E2EInfo> {
1098        if let Self::RcvGroupE2EeInfo { e_2_ee_info, .. } = self {
1099            Some(e_2_ee_info)
1100        } else {
1101            None
1102        }
1103    }
1104    pub fn is_chat_banner(&self) -> bool {
1105        matches!(self, Self::ChatBanner)
1106    }
1107}
1108#[derive(Clone, Copy)]
1109pub struct CIContentSndCallRef<'a> {
1110    pub status: &'a CICallStatus,
1111    pub duration: &'a i32,
1112}
1113#[derive(Clone, Copy)]
1114pub struct CIContentRcvCallRef<'a> {
1115    pub status: &'a CICallStatus,
1116    pub duration: &'a i32,
1117}
1118#[derive(Clone, Copy)]
1119pub struct CIContentRcvDecryptionErrorRef<'a> {
1120    pub msg_decrypt_error: &'a MsgDecryptError,
1121    pub msg_count: &'a u32,
1122}
1123#[derive(Clone, Copy)]
1124pub struct CIContentRcvGroupInvitationRef<'a> {
1125    pub group_invitation: &'a CIGroupInvitation,
1126    pub member_role: &'a GroupMemberRole,
1127}
1128#[derive(Clone, Copy)]
1129pub struct CIContentSndGroupInvitationRef<'a> {
1130    pub group_invitation: &'a CIGroupInvitation,
1131    pub member_role: &'a GroupMemberRole,
1132}
1133#[derive(Clone, Copy)]
1134pub struct CIContentRcvChatFeatureRef<'a> {
1135    pub feature: &'a ChatFeature,
1136    pub enabled: &'a PrefEnabled,
1137    pub param: &'a Option<i32>,
1138}
1139#[derive(Clone, Copy)]
1140pub struct CIContentSndChatFeatureRef<'a> {
1141    pub feature: &'a ChatFeature,
1142    pub enabled: &'a PrefEnabled,
1143    pub param: &'a Option<i32>,
1144}
1145#[derive(Clone, Copy)]
1146pub struct CIContentRcvChatPreferenceRef<'a> {
1147    pub feature: &'a ChatFeature,
1148    pub allowed: &'a FeatureAllowed,
1149    pub param: &'a Option<i32>,
1150}
1151#[derive(Clone, Copy)]
1152pub struct CIContentSndChatPreferenceRef<'a> {
1153    pub feature: &'a ChatFeature,
1154    pub allowed: &'a FeatureAllowed,
1155    pub param: &'a Option<i32>,
1156}
1157#[derive(Clone, Copy)]
1158pub struct CIContentRcvGroupFeatureRef<'a> {
1159    pub group_feature: &'a GroupFeature,
1160    pub preference: &'a GroupPreference,
1161    pub param: &'a Option<i32>,
1162    pub member_role: &'a Option<GroupMemberRole>,
1163}
1164#[derive(Clone, Copy)]
1165pub struct CIContentSndGroupFeatureRef<'a> {
1166    pub group_feature: &'a GroupFeature,
1167    pub preference: &'a GroupPreference,
1168    pub param: &'a Option<i32>,
1169    pub member_role: &'a Option<GroupMemberRole>,
1170}
1171
1172#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1173#[non_exhaustive]
1174pub enum CIDeleteMode {
1175    #[default]
1176    #[serde(rename = "broadcast")]
1177    Broadcast,
1178    #[serde(rename = "internal")]
1179    Internal,
1180    #[serde(rename = "internalMark")]
1181    InternalMark,
1182    #[serde(rename = "history")]
1183    History,
1184}
1185
1186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1187#[serde(tag = "type")]
1188#[non_exhaustive]
1189pub enum CIDeleted {
1190    #[serde(rename = "deleted")]
1191    Deleted {
1192        #[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
1193        deleted_ts: Option<UtcTime>,
1194
1195        #[serde(rename = "chatType")]
1196        chat_type: ChatType,
1197
1198        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1199        undocumented: JsonObject,
1200    },
1201    #[serde(rename = "blocked")]
1202    Blocked {
1203        #[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
1204        deleted_ts: Option<UtcTime>,
1205
1206        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1207        undocumented: JsonObject,
1208    },
1209    #[serde(rename = "blockedByAdmin")]
1210    BlockedByAdmin {
1211        #[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
1212        deleted_ts: Option<UtcTime>,
1213
1214        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1215        undocumented: JsonObject,
1216    },
1217    #[serde(rename = "moderated")]
1218    Moderated {
1219        #[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
1220        deleted_ts: Option<UtcTime>,
1221
1222        #[serde(rename = "byGroupMember")]
1223        by_group_member: GroupMember,
1224
1225        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1226        undocumented: JsonObject,
1227    },
1228    #[serde(untagged)]
1229    Undocumented(JsonObject),
1230}
1231
1232impl CIDeleted {
1233    pub fn make_deleted(deleted_ts: Option<UtcTime>, chat_type: ChatType) -> Self {
1234        Self::Deleted {
1235            deleted_ts,
1236            chat_type,
1237            undocumented: Default::default(),
1238        }
1239    }
1240
1241    pub fn make_blocked(deleted_ts: Option<UtcTime>) -> Self {
1242        Self::Blocked {
1243            deleted_ts,
1244            undocumented: Default::default(),
1245        }
1246    }
1247
1248    pub fn make_blocked_by_admin(deleted_ts: Option<UtcTime>) -> Self {
1249        Self::BlockedByAdmin {
1250            deleted_ts,
1251            undocumented: Default::default(),
1252        }
1253    }
1254
1255    pub fn make_moderated(deleted_ts: Option<UtcTime>, by_group_member: GroupMember) -> Self {
1256        Self::Moderated {
1257            deleted_ts,
1258            by_group_member,
1259            undocumented: Default::default(),
1260        }
1261    }
1262}
1263
1264impl CIDeleted {
1265    pub fn deleted(&self) -> Option<CIDeletedDeletedRef<'_>> {
1266        if let Self::Deleted {
1267            deleted_ts,
1268            chat_type,
1269            ..
1270        } = self
1271        {
1272            Some(CIDeletedDeletedRef {
1273                deleted_ts,
1274                chat_type,
1275            })
1276        } else {
1277            None
1278        }
1279    }
1280    pub fn blocked(&self) -> Option<&Option<UtcTime>> {
1281        if let Self::Blocked { deleted_ts, .. } = self {
1282            Some(deleted_ts)
1283        } else {
1284            None
1285        }
1286    }
1287    pub fn blocked_by_admin(&self) -> Option<&Option<UtcTime>> {
1288        if let Self::BlockedByAdmin { deleted_ts, .. } = self {
1289            Some(deleted_ts)
1290        } else {
1291            None
1292        }
1293    }
1294    pub fn moderated(&self) -> Option<CIDeletedModeratedRef<'_>> {
1295        if let Self::Moderated {
1296            deleted_ts,
1297            by_group_member,
1298            ..
1299        } = self
1300        {
1301            Some(CIDeletedModeratedRef {
1302                deleted_ts,
1303                by_group_member,
1304            })
1305        } else {
1306            None
1307        }
1308    }
1309}
1310#[derive(Clone, Copy)]
1311pub struct CIDeletedDeletedRef<'a> {
1312    pub deleted_ts: &'a Option<UtcTime>,
1313    pub chat_type: &'a ChatType,
1314}
1315#[derive(Clone, Copy)]
1316pub struct CIDeletedModeratedRef<'a> {
1317    pub deleted_ts: &'a Option<UtcTime>,
1318    pub by_group_member: &'a GroupMember,
1319}
1320
1321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1322#[serde(tag = "type")]
1323#[non_exhaustive]
1324pub enum CIDirection {
1325    #[serde(rename = "directSnd")]
1326    DirectSnd,
1327    #[serde(rename = "directRcv")]
1328    DirectRcv,
1329    #[serde(rename = "groupSnd")]
1330    GroupSnd,
1331    #[serde(rename = "groupRcv")]
1332    GroupRcv {
1333        #[serde(rename = "groupMember")]
1334        group_member: GroupMember,
1335
1336        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1337        undocumented: JsonObject,
1338    },
1339    #[serde(rename = "channelRcv")]
1340    ChannelRcv,
1341    #[serde(rename = "localSnd")]
1342    LocalSnd,
1343    #[serde(rename = "localRcv")]
1344    LocalRcv,
1345    #[serde(untagged)]
1346    Undocumented(JsonObject),
1347}
1348
1349impl CIDirection {
1350    pub fn make_direct_snd() -> Self {
1351        Self::DirectSnd
1352    }
1353
1354    pub fn make_direct_rcv() -> Self {
1355        Self::DirectRcv
1356    }
1357
1358    pub fn make_group_snd() -> Self {
1359        Self::GroupSnd
1360    }
1361
1362    pub fn make_group_rcv(group_member: GroupMember) -> Self {
1363        Self::GroupRcv {
1364            group_member,
1365            undocumented: Default::default(),
1366        }
1367    }
1368
1369    pub fn make_channel_rcv() -> Self {
1370        Self::ChannelRcv
1371    }
1372
1373    pub fn make_local_snd() -> Self {
1374        Self::LocalSnd
1375    }
1376
1377    pub fn make_local_rcv() -> Self {
1378        Self::LocalRcv
1379    }
1380}
1381
1382impl CIDirection {
1383    pub fn is_direct_snd(&self) -> bool {
1384        matches!(self, Self::DirectSnd)
1385    }
1386    pub fn is_direct_rcv(&self) -> bool {
1387        matches!(self, Self::DirectRcv)
1388    }
1389    pub fn is_group_snd(&self) -> bool {
1390        matches!(self, Self::GroupSnd)
1391    }
1392    pub fn group_rcv(&self) -> Option<&GroupMember> {
1393        if let Self::GroupRcv { group_member, .. } = self {
1394            Some(group_member)
1395        } else {
1396            None
1397        }
1398    }
1399    pub fn is_channel_rcv(&self) -> bool {
1400        matches!(self, Self::ChannelRcv)
1401    }
1402    pub fn is_local_snd(&self) -> bool {
1403        matches!(self, Self::LocalSnd)
1404    }
1405    pub fn is_local_rcv(&self) -> bool {
1406        matches!(self, Self::LocalRcv)
1407    }
1408}
1409
1410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1411#[cfg_attr(feature = "bon", derive(::bon::Builder))]
1412#[cfg_attr(feature = "bon", builder(on(String, into)))]
1413pub struct CIFile {
1414    #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
1415    pub file_id: i64,
1416
1417    #[serde(rename = "fileName")]
1418    pub file_name: String,
1419
1420    #[serde(
1421        rename = "fileSize",
1422        deserialize_with = "deserialize_number_from_string"
1423    )]
1424    pub file_size: i64,
1425
1426    #[serde(rename = "fileSource", skip_serializing_if = "Option::is_none")]
1427    pub file_source: Option<CryptoFile>,
1428
1429    #[serde(rename = "fileStatus")]
1430    pub file_status: CIFileStatus,
1431
1432    #[serde(rename = "fileProtocol")]
1433    pub file_protocol: FileProtocol,
1434
1435    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1436    #[cfg_attr(feature = "bon", builder(default))]
1437    pub undocumented: JsonObject,
1438}
1439
1440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1441#[serde(tag = "type")]
1442#[non_exhaustive]
1443pub enum CIFileStatus {
1444    #[serde(rename = "sndStored")]
1445    SndStored,
1446    #[serde(rename = "sndTransfer")]
1447    SndTransfer {
1448        #[serde(
1449            rename = "sndProgress",
1450            deserialize_with = "deserialize_number_from_string"
1451        )]
1452        snd_progress: i64,
1453
1454        #[serde(
1455            rename = "sndTotal",
1456            deserialize_with = "deserialize_number_from_string"
1457        )]
1458        snd_total: i64,
1459
1460        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1461        undocumented: JsonObject,
1462    },
1463    #[serde(rename = "sndCancelled")]
1464    SndCancelled,
1465    #[serde(rename = "sndComplete")]
1466    SndComplete,
1467    #[serde(rename = "sndError")]
1468    SndError {
1469        #[serde(rename = "sndFileError")]
1470        snd_file_error: FileError,
1471
1472        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1473        undocumented: JsonObject,
1474    },
1475    #[serde(rename = "sndWarning")]
1476    SndWarning {
1477        #[serde(rename = "sndFileError")]
1478        snd_file_error: FileError,
1479
1480        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1481        undocumented: JsonObject,
1482    },
1483    #[serde(rename = "rcvInvitation")]
1484    RcvInvitation,
1485    #[serde(rename = "rcvAccepted")]
1486    RcvAccepted,
1487    #[serde(rename = "rcvTransfer")]
1488    RcvTransfer {
1489        #[serde(
1490            rename = "rcvProgress",
1491            deserialize_with = "deserialize_number_from_string"
1492        )]
1493        rcv_progress: i64,
1494
1495        #[serde(
1496            rename = "rcvTotal",
1497            deserialize_with = "deserialize_number_from_string"
1498        )]
1499        rcv_total: i64,
1500
1501        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1502        undocumented: JsonObject,
1503    },
1504    #[serde(rename = "rcvAborted")]
1505    RcvAborted,
1506    #[serde(rename = "rcvComplete")]
1507    RcvComplete,
1508    #[serde(rename = "rcvCancelled")]
1509    RcvCancelled,
1510    #[serde(rename = "rcvError")]
1511    RcvError {
1512        #[serde(rename = "rcvFileError")]
1513        rcv_file_error: FileError,
1514
1515        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1516        undocumented: JsonObject,
1517    },
1518    #[serde(rename = "rcvWarning")]
1519    RcvWarning {
1520        #[serde(rename = "rcvFileError")]
1521        rcv_file_error: FileError,
1522
1523        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1524        undocumented: JsonObject,
1525    },
1526    #[serde(rename = "invalid")]
1527    Invalid {
1528        #[serde(rename = "text")]
1529        text: String,
1530
1531        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1532        undocumented: JsonObject,
1533    },
1534    #[serde(untagged)]
1535    Undocumented(JsonObject),
1536}
1537
1538impl CIFileStatus {
1539    pub fn make_snd_stored() -> Self {
1540        Self::SndStored
1541    }
1542
1543    pub fn make_snd_transfer(snd_progress: i64, snd_total: i64) -> Self {
1544        Self::SndTransfer {
1545            snd_progress,
1546            snd_total,
1547            undocumented: Default::default(),
1548        }
1549    }
1550
1551    pub fn make_snd_cancelled() -> Self {
1552        Self::SndCancelled
1553    }
1554
1555    pub fn make_snd_complete() -> Self {
1556        Self::SndComplete
1557    }
1558
1559    pub fn make_snd_error(snd_file_error: FileError) -> Self {
1560        Self::SndError {
1561            snd_file_error,
1562            undocumented: Default::default(),
1563        }
1564    }
1565
1566    pub fn make_snd_warning(snd_file_error: FileError) -> Self {
1567        Self::SndWarning {
1568            snd_file_error,
1569            undocumented: Default::default(),
1570        }
1571    }
1572
1573    pub fn make_rcv_invitation() -> Self {
1574        Self::RcvInvitation
1575    }
1576
1577    pub fn make_rcv_accepted() -> Self {
1578        Self::RcvAccepted
1579    }
1580
1581    pub fn make_rcv_transfer(rcv_progress: i64, rcv_total: i64) -> Self {
1582        Self::RcvTransfer {
1583            rcv_progress,
1584            rcv_total,
1585            undocumented: Default::default(),
1586        }
1587    }
1588
1589    pub fn make_rcv_aborted() -> Self {
1590        Self::RcvAborted
1591    }
1592
1593    pub fn make_rcv_complete() -> Self {
1594        Self::RcvComplete
1595    }
1596
1597    pub fn make_rcv_cancelled() -> Self {
1598        Self::RcvCancelled
1599    }
1600
1601    pub fn make_rcv_error(rcv_file_error: FileError) -> Self {
1602        Self::RcvError {
1603            rcv_file_error,
1604            undocumented: Default::default(),
1605        }
1606    }
1607
1608    pub fn make_rcv_warning(rcv_file_error: FileError) -> Self {
1609        Self::RcvWarning {
1610            rcv_file_error,
1611            undocumented: Default::default(),
1612        }
1613    }
1614
1615    pub fn make_invalid(text: String) -> Self {
1616        Self::Invalid {
1617            text,
1618            undocumented: Default::default(),
1619        }
1620    }
1621}
1622
1623impl CIFileStatus {
1624    pub fn is_snd_stored(&self) -> bool {
1625        matches!(self, Self::SndStored)
1626    }
1627    pub fn snd_transfer(&self) -> Option<CIFileStatusSndTransferRef<'_>> {
1628        if let Self::SndTransfer {
1629            snd_progress,
1630            snd_total,
1631            ..
1632        } = self
1633        {
1634            Some(CIFileStatusSndTransferRef {
1635                snd_progress,
1636                snd_total,
1637            })
1638        } else {
1639            None
1640        }
1641    }
1642    pub fn is_snd_cancelled(&self) -> bool {
1643        matches!(self, Self::SndCancelled)
1644    }
1645    pub fn is_snd_complete(&self) -> bool {
1646        matches!(self, Self::SndComplete)
1647    }
1648    pub fn snd_error(&self) -> Option<&FileError> {
1649        if let Self::SndError { snd_file_error, .. } = self {
1650            Some(snd_file_error)
1651        } else {
1652            None
1653        }
1654    }
1655    pub fn snd_warning(&self) -> Option<&FileError> {
1656        if let Self::SndWarning { snd_file_error, .. } = self {
1657            Some(snd_file_error)
1658        } else {
1659            None
1660        }
1661    }
1662    pub fn is_rcv_invitation(&self) -> bool {
1663        matches!(self, Self::RcvInvitation)
1664    }
1665    pub fn is_rcv_accepted(&self) -> bool {
1666        matches!(self, Self::RcvAccepted)
1667    }
1668    pub fn rcv_transfer(&self) -> Option<CIFileStatusRcvTransferRef<'_>> {
1669        if let Self::RcvTransfer {
1670            rcv_progress,
1671            rcv_total,
1672            ..
1673        } = self
1674        {
1675            Some(CIFileStatusRcvTransferRef {
1676                rcv_progress,
1677                rcv_total,
1678            })
1679        } else {
1680            None
1681        }
1682    }
1683    pub fn is_rcv_aborted(&self) -> bool {
1684        matches!(self, Self::RcvAborted)
1685    }
1686    pub fn is_rcv_complete(&self) -> bool {
1687        matches!(self, Self::RcvComplete)
1688    }
1689    pub fn is_rcv_cancelled(&self) -> bool {
1690        matches!(self, Self::RcvCancelled)
1691    }
1692    pub fn rcv_error(&self) -> Option<&FileError> {
1693        if let Self::RcvError { rcv_file_error, .. } = self {
1694            Some(rcv_file_error)
1695        } else {
1696            None
1697        }
1698    }
1699    pub fn rcv_warning(&self) -> Option<&FileError> {
1700        if let Self::RcvWarning { rcv_file_error, .. } = self {
1701            Some(rcv_file_error)
1702        } else {
1703            None
1704        }
1705    }
1706    pub fn invalid(&self) -> Option<&String> {
1707        if let Self::Invalid { text, .. } = self {
1708            Some(text)
1709        } else {
1710            None
1711        }
1712    }
1713}
1714#[derive(Clone, Copy)]
1715pub struct CIFileStatusSndTransferRef<'a> {
1716    pub snd_progress: &'a i64,
1717    pub snd_total: &'a i64,
1718}
1719#[derive(Clone, Copy)]
1720pub struct CIFileStatusRcvTransferRef<'a> {
1721    pub rcv_progress: &'a i64,
1722    pub rcv_total: &'a i64,
1723}
1724
1725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1726#[serde(tag = "type")]
1727#[non_exhaustive]
1728pub enum CIForwardedFrom {
1729    #[serde(rename = "unknown")]
1730    Unknown,
1731    #[serde(rename = "contact")]
1732    Contact {
1733        #[serde(rename = "chatName")]
1734        chat_name: String,
1735
1736        #[serde(rename = "msgDir")]
1737        msg_dir: MsgDirection,
1738
1739        #[serde(
1740            rename = "contactId",
1741            skip_serializing_if = "Option::is_none",
1742            deserialize_with = "deserialize_option_number_from_string",
1743            default
1744        )]
1745        contact_id: Option<i64>,
1746
1747        #[serde(
1748            rename = "chatItemId",
1749            skip_serializing_if = "Option::is_none",
1750            deserialize_with = "deserialize_option_number_from_string",
1751            default
1752        )]
1753        chat_item_id: Option<i64>,
1754
1755        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1756        undocumented: JsonObject,
1757    },
1758    #[serde(rename = "group")]
1759    Group {
1760        #[serde(rename = "chatName")]
1761        chat_name: String,
1762
1763        #[serde(rename = "msgDir")]
1764        msg_dir: MsgDirection,
1765
1766        #[serde(
1767            rename = "groupId",
1768            skip_serializing_if = "Option::is_none",
1769            deserialize_with = "deserialize_option_number_from_string",
1770            default
1771        )]
1772        group_id: Option<i64>,
1773
1774        #[serde(
1775            rename = "chatItemId",
1776            skip_serializing_if = "Option::is_none",
1777            deserialize_with = "deserialize_option_number_from_string",
1778            default
1779        )]
1780        chat_item_id: Option<i64>,
1781
1782        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1783        undocumented: JsonObject,
1784    },
1785    #[serde(untagged)]
1786    Undocumented(JsonObject),
1787}
1788
1789impl CIForwardedFrom {
1790    pub fn make_unknown() -> Self {
1791        Self::Unknown
1792    }
1793
1794    pub fn make_contact(
1795        chat_name: String,
1796        msg_dir: MsgDirection,
1797        contact_id: Option<i64>,
1798        chat_item_id: Option<i64>,
1799    ) -> Self {
1800        Self::Contact {
1801            chat_name,
1802            msg_dir,
1803            contact_id,
1804            chat_item_id,
1805            undocumented: Default::default(),
1806        }
1807    }
1808
1809    pub fn make_group(
1810        chat_name: String,
1811        msg_dir: MsgDirection,
1812        group_id: Option<i64>,
1813        chat_item_id: Option<i64>,
1814    ) -> Self {
1815        Self::Group {
1816            chat_name,
1817            msg_dir,
1818            group_id,
1819            chat_item_id,
1820            undocumented: Default::default(),
1821        }
1822    }
1823}
1824
1825impl CIForwardedFrom {
1826    pub fn is_unknown(&self) -> bool {
1827        matches!(self, Self::Unknown)
1828    }
1829    pub fn contact(&self) -> Option<CIForwardedFromContactRef<'_>> {
1830        if let Self::Contact {
1831            chat_name,
1832            msg_dir,
1833            contact_id,
1834            chat_item_id,
1835            ..
1836        } = self
1837        {
1838            Some(CIForwardedFromContactRef {
1839                chat_name,
1840                msg_dir,
1841                contact_id,
1842                chat_item_id,
1843            })
1844        } else {
1845            None
1846        }
1847    }
1848    pub fn group(&self) -> Option<CIForwardedFromGroupRef<'_>> {
1849        if let Self::Group {
1850            chat_name,
1851            msg_dir,
1852            group_id,
1853            chat_item_id,
1854            ..
1855        } = self
1856        {
1857            Some(CIForwardedFromGroupRef {
1858                chat_name,
1859                msg_dir,
1860                group_id,
1861                chat_item_id,
1862            })
1863        } else {
1864            None
1865        }
1866    }
1867}
1868#[derive(Clone, Copy)]
1869pub struct CIForwardedFromContactRef<'a> {
1870    pub chat_name: &'a String,
1871    pub msg_dir: &'a MsgDirection,
1872    pub contact_id: &'a Option<i64>,
1873    pub chat_item_id: &'a Option<i64>,
1874}
1875#[derive(Clone, Copy)]
1876pub struct CIForwardedFromGroupRef<'a> {
1877    pub chat_name: &'a String,
1878    pub msg_dir: &'a MsgDirection,
1879    pub group_id: &'a Option<i64>,
1880    pub chat_item_id: &'a Option<i64>,
1881}
1882
1883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1884#[cfg_attr(feature = "bon", derive(::bon::Builder))]
1885#[cfg_attr(feature = "bon", builder(on(String, into)))]
1886pub struct CIGroupInvitation {
1887    #[serde(
1888        rename = "groupId",
1889        deserialize_with = "deserialize_number_from_string"
1890    )]
1891    pub group_id: i64,
1892
1893    #[serde(
1894        rename = "groupMemberId",
1895        deserialize_with = "deserialize_number_from_string"
1896    )]
1897    pub group_member_id: i64,
1898
1899    #[serde(rename = "localDisplayName")]
1900    pub local_display_name: String,
1901
1902    #[serde(rename = "groupProfile")]
1903    pub group_profile: GroupProfile,
1904
1905    #[serde(rename = "status")]
1906    pub status: CIGroupInvitationStatus,
1907
1908    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1909    #[cfg_attr(feature = "bon", builder(default))]
1910    pub undocumented: JsonObject,
1911}
1912
1913#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1914#[non_exhaustive]
1915pub enum CIGroupInvitationStatus {
1916    #[default]
1917    #[serde(rename = "pending")]
1918    Pending,
1919    #[serde(rename = "accepted")]
1920    Accepted,
1921    #[serde(rename = "rejected")]
1922    Rejected,
1923    #[serde(rename = "expired")]
1924    Expired,
1925}
1926
1927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1928#[cfg_attr(feature = "bon", derive(::bon::Builder))]
1929#[cfg_attr(feature = "bon", builder(on(String, into)))]
1930pub struct CIMention {
1931    #[serde(rename = "memberId")]
1932    pub member_id: String,
1933
1934    #[serde(rename = "memberRef", skip_serializing_if = "Option::is_none")]
1935    pub member_ref: Option<CIMentionMember>,
1936
1937    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1938    #[cfg_attr(feature = "bon", builder(default))]
1939    pub undocumented: JsonObject,
1940}
1941
1942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1943#[cfg_attr(feature = "bon", derive(::bon::Builder))]
1944#[cfg_attr(feature = "bon", builder(on(String, into)))]
1945pub struct CIMentionMember {
1946    #[serde(
1947        rename = "groupMemberId",
1948        deserialize_with = "deserialize_number_from_string"
1949    )]
1950    pub group_member_id: i64,
1951
1952    #[serde(rename = "displayName")]
1953    pub display_name: String,
1954
1955    #[serde(rename = "localAlias", skip_serializing_if = "Option::is_none")]
1956    pub local_alias: Option<String>,
1957
1958    #[serde(rename = "memberRole")]
1959    pub member_role: GroupMemberRole,
1960
1961    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1962    #[cfg_attr(feature = "bon", builder(default))]
1963    pub undocumented: JsonObject,
1964}
1965
1966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1967#[cfg_attr(feature = "bon", derive(::bon::Builder))]
1968#[cfg_attr(feature = "bon", builder(on(String, into)))]
1969pub struct CIMeta {
1970    #[serde(rename = "itemId", deserialize_with = "deserialize_number_from_string")]
1971    pub item_id: i64,
1972
1973    #[serde(rename = "itemTs")]
1974    pub item_ts: UtcTime,
1975
1976    #[serde(rename = "itemText")]
1977    pub item_text: String,
1978
1979    #[serde(rename = "itemStatus")]
1980    pub item_status: CIStatus,
1981
1982    #[serde(rename = "sentViaProxy", skip_serializing_if = "Option::is_none")]
1983    pub sent_via_proxy: Option<bool>,
1984
1985    #[serde(rename = "itemSharedMsgId", skip_serializing_if = "Option::is_none")]
1986    pub item_shared_msg_id: Option<String>,
1987
1988    #[serde(rename = "itemForwarded", skip_serializing_if = "Option::is_none")]
1989    pub item_forwarded: Option<CIForwardedFrom>,
1990
1991    #[serde(rename = "itemDeleted", skip_serializing_if = "Option::is_none")]
1992    pub item_deleted: Option<CIDeleted>,
1993
1994    #[serde(rename = "itemEdited", default)]
1995    pub item_edited: bool,
1996
1997    #[serde(rename = "itemTimed", skip_serializing_if = "Option::is_none")]
1998    pub item_timed: Option<CITimed>,
1999
2000    #[serde(rename = "itemLive", skip_serializing_if = "Option::is_none")]
2001    pub item_live: Option<bool>,
2002
2003    #[serde(rename = "userMention", default)]
2004    pub user_mention: bool,
2005
2006    #[serde(rename = "hasLink", default)]
2007    pub has_link: bool,
2008
2009    #[serde(rename = "deletable", default)]
2010    pub deletable: bool,
2011
2012    #[serde(rename = "editable", default)]
2013    pub editable: bool,
2014
2015    #[serde(
2016        rename = "forwardedByMember",
2017        skip_serializing_if = "Option::is_none",
2018        deserialize_with = "deserialize_option_number_from_string",
2019        default
2020    )]
2021    pub forwarded_by_member: Option<i64>,
2022
2023    #[serde(rename = "showGroupAsSender", default)]
2024    pub show_group_as_sender: bool,
2025
2026    #[serde(rename = "msgSigned", skip_serializing_if = "Option::is_none")]
2027    pub msg_signed: Option<MsgSigStatus>,
2028
2029    #[serde(rename = "createdAt")]
2030    pub created_at: UtcTime,
2031
2032    #[serde(rename = "updatedAt")]
2033    pub updated_at: UtcTime,
2034
2035    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2036    #[cfg_attr(feature = "bon", builder(default))]
2037    pub undocumented: JsonObject,
2038}
2039
2040#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2041#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2042#[cfg_attr(feature = "bon", builder(on(String, into)))]
2043pub struct CIQuote {
2044    #[serde(rename = "chatDir", skip_serializing_if = "Option::is_none")]
2045    pub chat_dir: Option<CIDirection>,
2046
2047    #[serde(
2048        rename = "itemId",
2049        skip_serializing_if = "Option::is_none",
2050        deserialize_with = "deserialize_option_number_from_string",
2051        default
2052    )]
2053    pub item_id: Option<i64>,
2054
2055    #[serde(rename = "sharedMsgId", skip_serializing_if = "Option::is_none")]
2056    pub shared_msg_id: Option<String>,
2057
2058    #[serde(rename = "sentAt")]
2059    pub sent_at: UtcTime,
2060
2061    #[serde(rename = "content")]
2062    pub content: MsgContent,
2063
2064    #[serde(rename = "formattedText", skip_serializing_if = "Option::is_none")]
2065    pub formatted_text: Option<Vec<FormattedText>>,
2066
2067    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2068    #[cfg_attr(feature = "bon", builder(default))]
2069    pub undocumented: JsonObject,
2070}
2071
2072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2073#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2074#[cfg_attr(feature = "bon", builder(on(String, into)))]
2075pub struct CIReaction {
2076    #[serde(rename = "chatDir")]
2077    pub chat_dir: CIDirection,
2078
2079    #[serde(rename = "chatItem")]
2080    pub chat_item: ChatItem,
2081
2082    #[serde(rename = "sentAt")]
2083    pub sent_at: UtcTime,
2084
2085    #[serde(rename = "reaction")]
2086    pub reaction: MsgReaction,
2087
2088    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2089    #[cfg_attr(feature = "bon", builder(default))]
2090    pub undocumented: JsonObject,
2091}
2092
2093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2094#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2095#[cfg_attr(feature = "bon", builder(on(String, into)))]
2096pub struct CIReactionCount {
2097    #[serde(rename = "reaction")]
2098    pub reaction: MsgReaction,
2099
2100    #[serde(rename = "userReacted", default)]
2101    pub user_reacted: bool,
2102
2103    #[serde(
2104        rename = "totalReacted",
2105        deserialize_with = "deserialize_number_from_string"
2106    )]
2107    pub total_reacted: i32,
2108
2109    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2110    #[cfg_attr(feature = "bon", builder(default))]
2111    pub undocumented: JsonObject,
2112}
2113
2114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2115#[serde(tag = "type")]
2116#[non_exhaustive]
2117pub enum CIStatus {
2118    #[serde(rename = "sndNew")]
2119    SndNew,
2120    #[serde(rename = "sndSent")]
2121    SndSent {
2122        #[serde(rename = "sndProgress")]
2123        snd_progress: SndCIStatusProgress,
2124
2125        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2126        undocumented: JsonObject,
2127    },
2128    #[serde(rename = "sndRcvd")]
2129    SndRcvd {
2130        #[serde(rename = "msgRcptStatus")]
2131        msg_rcpt_status: MsgReceiptStatus,
2132
2133        #[serde(rename = "sndProgress")]
2134        snd_progress: SndCIStatusProgress,
2135
2136        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2137        undocumented: JsonObject,
2138    },
2139    #[serde(rename = "sndErrorAuth")]
2140    SndErrorAuth,
2141    #[serde(rename = "sndError")]
2142    SndError {
2143        #[serde(rename = "agentError")]
2144        agent_error: SndError,
2145
2146        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2147        undocumented: JsonObject,
2148    },
2149    #[serde(rename = "sndWarning")]
2150    SndWarning {
2151        #[serde(rename = "agentError")]
2152        agent_error: SndError,
2153
2154        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2155        undocumented: JsonObject,
2156    },
2157    #[serde(rename = "rcvNew")]
2158    RcvNew,
2159    #[serde(rename = "rcvRead")]
2160    RcvRead,
2161    #[serde(rename = "invalid")]
2162    Invalid {
2163        #[serde(rename = "text")]
2164        text: String,
2165
2166        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2167        undocumented: JsonObject,
2168    },
2169    #[serde(untagged)]
2170    Undocumented(JsonObject),
2171}
2172
2173impl CIStatus {
2174    pub fn make_snd_new() -> Self {
2175        Self::SndNew
2176    }
2177
2178    pub fn make_snd_sent(snd_progress: SndCIStatusProgress) -> Self {
2179        Self::SndSent {
2180            snd_progress,
2181            undocumented: Default::default(),
2182        }
2183    }
2184
2185    pub fn make_snd_rcvd(
2186        msg_rcpt_status: MsgReceiptStatus,
2187        snd_progress: SndCIStatusProgress,
2188    ) -> Self {
2189        Self::SndRcvd {
2190            msg_rcpt_status,
2191            snd_progress,
2192            undocumented: Default::default(),
2193        }
2194    }
2195
2196    pub fn make_snd_error_auth() -> Self {
2197        Self::SndErrorAuth
2198    }
2199
2200    pub fn make_snd_error(agent_error: SndError) -> Self {
2201        Self::SndError {
2202            agent_error,
2203            undocumented: Default::default(),
2204        }
2205    }
2206
2207    pub fn make_snd_warning(agent_error: SndError) -> Self {
2208        Self::SndWarning {
2209            agent_error,
2210            undocumented: Default::default(),
2211        }
2212    }
2213
2214    pub fn make_rcv_new() -> Self {
2215        Self::RcvNew
2216    }
2217
2218    pub fn make_rcv_read() -> Self {
2219        Self::RcvRead
2220    }
2221
2222    pub fn make_invalid(text: String) -> Self {
2223        Self::Invalid {
2224            text,
2225            undocumented: Default::default(),
2226        }
2227    }
2228}
2229
2230impl CIStatus {
2231    pub fn is_snd_new(&self) -> bool {
2232        matches!(self, Self::SndNew)
2233    }
2234    pub fn snd_sent(&self) -> Option<&SndCIStatusProgress> {
2235        if let Self::SndSent { snd_progress, .. } = self {
2236            Some(snd_progress)
2237        } else {
2238            None
2239        }
2240    }
2241    pub fn snd_rcvd(&self) -> Option<CIStatusSndRcvdRef<'_>> {
2242        if let Self::SndRcvd {
2243            msg_rcpt_status,
2244            snd_progress,
2245            ..
2246        } = self
2247        {
2248            Some(CIStatusSndRcvdRef {
2249                msg_rcpt_status,
2250                snd_progress,
2251            })
2252        } else {
2253            None
2254        }
2255    }
2256    pub fn is_snd_error_auth(&self) -> bool {
2257        matches!(self, Self::SndErrorAuth)
2258    }
2259    pub fn snd_error(&self) -> Option<&SndError> {
2260        if let Self::SndError { agent_error, .. } = self {
2261            Some(agent_error)
2262        } else {
2263            None
2264        }
2265    }
2266    pub fn snd_warning(&self) -> Option<&SndError> {
2267        if let Self::SndWarning { agent_error, .. } = self {
2268            Some(agent_error)
2269        } else {
2270            None
2271        }
2272    }
2273    pub fn is_rcv_new(&self) -> bool {
2274        matches!(self, Self::RcvNew)
2275    }
2276    pub fn is_rcv_read(&self) -> bool {
2277        matches!(self, Self::RcvRead)
2278    }
2279    pub fn invalid(&self) -> Option<&String> {
2280        if let Self::Invalid { text, .. } = self {
2281            Some(text)
2282        } else {
2283            None
2284        }
2285    }
2286}
2287#[derive(Clone, Copy)]
2288pub struct CIStatusSndRcvdRef<'a> {
2289    pub msg_rcpt_status: &'a MsgReceiptStatus,
2290    pub snd_progress: &'a SndCIStatusProgress,
2291}
2292
2293#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2294#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2295#[cfg_attr(feature = "bon", builder(on(String, into)))]
2296pub struct CITimed {
2297    #[serde(rename = "ttl", deserialize_with = "deserialize_number_from_string")]
2298    pub ttl: i32,
2299
2300    #[serde(rename = "deleteAt", skip_serializing_if = "Option::is_none")]
2301    pub delete_at: Option<UtcTime>,
2302
2303    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2304    #[cfg_attr(feature = "bon", builder(default))]
2305    pub undocumented: JsonObject,
2306}
2307
2308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2309#[serde(tag = "type")]
2310#[non_exhaustive]
2311pub enum ChatBotCommand {
2312    #[serde(rename = "command")]
2313    Command {
2314        #[serde(rename = "keyword")]
2315        keyword: String,
2316
2317        #[serde(rename = "label")]
2318        label: String,
2319
2320        #[serde(rename = "params", skip_serializing_if = "Option::is_none")]
2321        params: Option<String>,
2322
2323        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2324        undocumented: JsonObject,
2325    },
2326    #[serde(rename = "menu")]
2327    Menu {
2328        #[serde(rename = "label")]
2329        label: String,
2330
2331        #[serde(rename = "commands")]
2332        commands: Vec<ChatBotCommand>,
2333
2334        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2335        undocumented: JsonObject,
2336    },
2337    #[serde(untagged)]
2338    Undocumented(JsonObject),
2339}
2340
2341impl ChatBotCommand {
2342    pub fn make_command(keyword: String, label: String, params: Option<String>) -> Self {
2343        Self::Command {
2344            keyword,
2345            label,
2346            params,
2347            undocumented: Default::default(),
2348        }
2349    }
2350
2351    pub fn make_menu(label: String, commands: Vec<ChatBotCommand>) -> Self {
2352        Self::Menu {
2353            label,
2354            commands,
2355            undocumented: Default::default(),
2356        }
2357    }
2358}
2359
2360impl ChatBotCommand {
2361    pub fn command(&self) -> Option<ChatBotCommandCommandRef<'_>> {
2362        if let Self::Command {
2363            keyword,
2364            label,
2365            params,
2366            ..
2367        } = self
2368        {
2369            Some(ChatBotCommandCommandRef {
2370                keyword,
2371                label,
2372                params,
2373            })
2374        } else {
2375            None
2376        }
2377    }
2378    pub fn menu(&self) -> Option<ChatBotCommandMenuRef<'_>> {
2379        if let Self::Menu {
2380            label, commands, ..
2381        } = self
2382        {
2383            Some(ChatBotCommandMenuRef { label, commands })
2384        } else {
2385            None
2386        }
2387    }
2388}
2389#[derive(Clone, Copy)]
2390pub struct ChatBotCommandCommandRef<'a> {
2391    pub keyword: &'a String,
2392    pub label: &'a String,
2393    pub params: &'a Option<String>,
2394}
2395#[derive(Clone, Copy)]
2396pub struct ChatBotCommandMenuRef<'a> {
2397    pub label: &'a String,
2398    pub commands: &'a Vec<ChatBotCommand>,
2399}
2400
2401/// *Syntax:*
2402///
2403/// ```
2404/// full|entity|messages[ notify=off]
2405/// ```
2406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2407#[serde(tag = "type")]
2408#[non_exhaustive]
2409pub enum ChatDeleteMode {
2410    #[serde(rename = "full")]
2411    Full {
2412        #[serde(rename = "notify", default)]
2413        notify: bool,
2414
2415        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2416        undocumented: JsonObject,
2417    },
2418    #[serde(rename = "entity")]
2419    Entity {
2420        #[serde(rename = "notify", default)]
2421        notify: bool,
2422
2423        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2424        undocumented: JsonObject,
2425    },
2426    #[serde(rename = "messages")]
2427    Messages,
2428    #[serde(untagged)]
2429    Undocumented(JsonObject),
2430}
2431
2432impl CommandSyntax for ChatDeleteMode {
2433    const COMMAND_BUF_SIZE: usize = 64;
2434
2435    fn append_command_syntax(&self, buf: &mut String) {
2436        match self {
2437            Self::Full { notify, .. } => {
2438                buf.push_str("full");
2439                if !notify {
2440                    buf.push_str(" notify=off");
2441                }
2442            }
2443            Self::Entity { notify, .. } => {
2444                buf.push_str("entity");
2445                if !notify {
2446                    buf.push_str(" notify=off");
2447                }
2448            }
2449            Self::Messages | Self::Undocumented(_) => {}
2450        }
2451    }
2452}
2453
2454impl ChatDeleteMode {
2455    pub fn make_full(notify: bool) -> Self {
2456        Self::Full {
2457            notify,
2458            undocumented: Default::default(),
2459        }
2460    }
2461
2462    pub fn make_entity(notify: bool) -> Self {
2463        Self::Entity {
2464            notify,
2465            undocumented: Default::default(),
2466        }
2467    }
2468
2469    pub fn make_messages() -> Self {
2470        Self::Messages
2471    }
2472}
2473
2474impl ChatDeleteMode {
2475    pub fn full(&self) -> Option<&bool> {
2476        if let Self::Full { notify, .. } = self {
2477            Some(notify)
2478        } else {
2479            None
2480        }
2481    }
2482    pub fn entity(&self) -> Option<&bool> {
2483        if let Self::Entity { notify, .. } = self {
2484            Some(notify)
2485        } else {
2486            None
2487        }
2488    }
2489    pub fn is_messages(&self) -> bool {
2490        matches!(self, Self::Messages)
2491    }
2492}
2493
2494#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
2495#[non_exhaustive]
2496pub enum ChatFeature {
2497    #[default]
2498    #[serde(rename = "timedMessages")]
2499    TimedMessages,
2500    #[serde(rename = "fullDelete")]
2501    FullDelete,
2502    #[serde(rename = "reactions")]
2503    Reactions,
2504    #[serde(rename = "voice")]
2505    Voice,
2506    #[serde(rename = "files")]
2507    Files,
2508    #[serde(rename = "calls")]
2509    Calls,
2510    #[serde(rename = "sessions")]
2511    Sessions,
2512}
2513
2514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2515#[serde(tag = "type")]
2516#[non_exhaustive]
2517pub enum ChatInfo {
2518    #[serde(rename = "direct")]
2519    Direct {
2520        #[serde(rename = "contact")]
2521        contact: Contact,
2522
2523        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2524        undocumented: JsonObject,
2525    },
2526    #[serde(rename = "group")]
2527    Group {
2528        #[serde(rename = "groupInfo")]
2529        group_info: GroupInfo,
2530
2531        #[serde(rename = "groupChatScope", skip_serializing_if = "Option::is_none")]
2532        group_chat_scope: Option<GroupChatScopeInfo>,
2533
2534        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2535        undocumented: JsonObject,
2536    },
2537    #[serde(rename = "local")]
2538    Local {
2539        #[serde(rename = "noteFolder")]
2540        note_folder: NoteFolder,
2541
2542        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2543        undocumented: JsonObject,
2544    },
2545    #[serde(rename = "contactRequest")]
2546    ContactRequest {
2547        #[serde(rename = "contactRequest")]
2548        contact_request: UserContactRequest,
2549
2550        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2551        undocumented: JsonObject,
2552    },
2553    #[serde(rename = "contactConnection")]
2554    ContactConnection {
2555        #[serde(rename = "contactConnection")]
2556        contact_connection: PendingContactConnection,
2557
2558        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2559        undocumented: JsonObject,
2560    },
2561    #[serde(untagged)]
2562    Undocumented(JsonObject),
2563}
2564
2565impl ChatInfo {
2566    pub fn make_direct(contact: Contact) -> Self {
2567        Self::Direct {
2568            contact,
2569            undocumented: Default::default(),
2570        }
2571    }
2572
2573    pub fn make_group(group_info: GroupInfo, group_chat_scope: Option<GroupChatScopeInfo>) -> Self {
2574        Self::Group {
2575            group_info,
2576            group_chat_scope,
2577            undocumented: Default::default(),
2578        }
2579    }
2580
2581    pub fn make_local(note_folder: NoteFolder) -> Self {
2582        Self::Local {
2583            note_folder,
2584            undocumented: Default::default(),
2585        }
2586    }
2587
2588    pub fn make_contact_request(contact_request: UserContactRequest) -> Self {
2589        Self::ContactRequest {
2590            contact_request,
2591            undocumented: Default::default(),
2592        }
2593    }
2594
2595    pub fn make_contact_connection(contact_connection: PendingContactConnection) -> Self {
2596        Self::ContactConnection {
2597            contact_connection,
2598            undocumented: Default::default(),
2599        }
2600    }
2601}
2602
2603impl ChatInfo {
2604    pub fn direct(&self) -> Option<&Contact> {
2605        if let Self::Direct { contact, .. } = self {
2606            Some(contact)
2607        } else {
2608            None
2609        }
2610    }
2611    pub fn group(&self) -> Option<ChatInfoGroupRef<'_>> {
2612        if let Self::Group {
2613            group_info,
2614            group_chat_scope,
2615            ..
2616        } = self
2617        {
2618            Some(ChatInfoGroupRef {
2619                group_info,
2620                group_chat_scope,
2621            })
2622        } else {
2623            None
2624        }
2625    }
2626    pub fn local(&self) -> Option<&NoteFolder> {
2627        if let Self::Local { note_folder, .. } = self {
2628            Some(note_folder)
2629        } else {
2630            None
2631        }
2632    }
2633    pub fn contact_request(&self) -> Option<&UserContactRequest> {
2634        if let Self::ContactRequest {
2635            contact_request, ..
2636        } = self
2637        {
2638            Some(contact_request)
2639        } else {
2640            None
2641        }
2642    }
2643    pub fn contact_connection(&self) -> Option<&PendingContactConnection> {
2644        if let Self::ContactConnection {
2645            contact_connection, ..
2646        } = self
2647        {
2648            Some(contact_connection)
2649        } else {
2650            None
2651        }
2652    }
2653}
2654#[derive(Clone, Copy)]
2655pub struct ChatInfoGroupRef<'a> {
2656    pub group_info: &'a GroupInfo,
2657    pub group_chat_scope: &'a Option<GroupChatScopeInfo>,
2658}
2659
2660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2661#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2662#[cfg_attr(feature = "bon", builder(on(String, into)))]
2663pub struct ChatItem {
2664    #[serde(rename = "chatDir")]
2665    pub chat_dir: CIDirection,
2666
2667    #[serde(rename = "meta")]
2668    pub meta: CIMeta,
2669
2670    #[serde(rename = "content")]
2671    pub content: CIContent,
2672
2673    #[serde(rename = "mentions")]
2674    pub mentions: BTreeMap<String, CIMention>,
2675
2676    #[serde(rename = "formattedText", skip_serializing_if = "Option::is_none")]
2677    pub formatted_text: Option<Vec<FormattedText>>,
2678
2679    #[serde(rename = "quotedItem", skip_serializing_if = "Option::is_none")]
2680    pub quoted_item: Option<CIQuote>,
2681
2682    #[serde(rename = "reactions")]
2683    pub reactions: Vec<CIReactionCount>,
2684
2685    #[serde(rename = "file", skip_serializing_if = "Option::is_none")]
2686    pub file: Option<CIFile>,
2687
2688    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2689    #[cfg_attr(feature = "bon", builder(default))]
2690    pub undocumented: JsonObject,
2691}
2692
2693/// Message deletion result.
2694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2695#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2696#[cfg_attr(feature = "bon", builder(on(String, into)))]
2697pub struct ChatItemDeletion {
2698    #[serde(rename = "deletedChatItem")]
2699    pub deleted_chat_item: AChatItem,
2700
2701    #[serde(rename = "toChatItem", skip_serializing_if = "Option::is_none")]
2702    pub to_chat_item: Option<AChatItem>,
2703
2704    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2705    #[cfg_attr(feature = "bon", builder(default))]
2706    pub undocumented: JsonObject,
2707}
2708
2709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2710#[serde(tag = "type")]
2711#[non_exhaustive]
2712pub enum ChatListQuery {
2713    #[serde(rename = "filters")]
2714    Filters {
2715        #[serde(rename = "favorite", default)]
2716        favorite: bool,
2717
2718        #[serde(rename = "unread", default)]
2719        unread: bool,
2720
2721        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2722        undocumented: JsonObject,
2723    },
2724    #[serde(rename = "search")]
2725    Search {
2726        #[serde(rename = "search")]
2727        search: String,
2728
2729        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2730        undocumented: JsonObject,
2731    },
2732    #[serde(untagged)]
2733    Undocumented(JsonObject),
2734}
2735
2736impl ChatListQuery {
2737    pub fn make_filters(favorite: bool, unread: bool) -> Self {
2738        Self::Filters {
2739            favorite,
2740            unread,
2741            undocumented: Default::default(),
2742        }
2743    }
2744
2745    pub fn make_search(search: String) -> Self {
2746        Self::Search {
2747            search,
2748            undocumented: Default::default(),
2749        }
2750    }
2751}
2752
2753impl ChatListQuery {
2754    pub fn filters(&self) -> Option<ChatListQueryFiltersRef<'_>> {
2755        if let Self::Filters {
2756            favorite, unread, ..
2757        } = self
2758        {
2759            Some(ChatListQueryFiltersRef { favorite, unread })
2760        } else {
2761            None
2762        }
2763    }
2764    pub fn search(&self) -> Option<&String> {
2765        if let Self::Search { search, .. } = self {
2766            Some(search)
2767        } else {
2768            None
2769        }
2770    }
2771}
2772#[derive(Clone, Copy)]
2773pub struct ChatListQueryFiltersRef<'a> {
2774    pub favorite: &'a bool,
2775    pub unread: &'a bool,
2776}
2777
2778#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
2779#[non_exhaustive]
2780pub enum ChatPeerType {
2781    #[default]
2782    #[serde(rename = "human")]
2783    Human,
2784    #[serde(rename = "bot")]
2785    Bot,
2786}
2787
2788/// Used in API commands. Chat scope can only be passed with groups.
2789///
2790/// *Syntax:*
2791///
2792/// ```
2793/// <str(chatType)><chatId>[<str(chatScope)>]
2794/// ```
2795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2796#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2797#[cfg_attr(feature = "bon", builder(on(String, into)))]
2798pub struct ChatRef {
2799    #[serde(rename = "chatType")]
2800    pub chat_type: ChatType,
2801
2802    #[serde(rename = "chatId", deserialize_with = "deserialize_number_from_string")]
2803    pub chat_id: i64,
2804
2805    #[serde(rename = "chatScope", skip_serializing_if = "Option::is_none")]
2806    pub chat_scope: Option<GroupChatScope>,
2807
2808    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2809    #[cfg_attr(feature = "bon", builder(default))]
2810    pub undocumented: JsonObject,
2811}
2812
2813impl CommandSyntax for ChatRef {
2814    const COMMAND_BUF_SIZE: usize = 256;
2815
2816    fn append_command_syntax(&self, buf: &mut String) {
2817        self.chat_type.append_command_syntax(buf);
2818        write!(buf, "{}", self.chat_id).unwrap();
2819        if let Some(chat_scope) = &self.chat_scope {
2820            chat_scope.append_command_syntax(buf);
2821        }
2822    }
2823}
2824
2825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2826#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2827#[cfg_attr(feature = "bon", builder(on(String, into)))]
2828pub struct ChatSettings {
2829    #[serde(rename = "enableNtfs")]
2830    pub enable_ntfs: MsgFilter,
2831
2832    #[serde(rename = "sendRcpts", skip_serializing_if = "Option::is_none")]
2833    pub send_rcpts: Option<bool>,
2834
2835    #[serde(rename = "favorite", default)]
2836    pub favorite: bool,
2837
2838    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2839    #[cfg_attr(feature = "bon", builder(default))]
2840    pub undocumented: JsonObject,
2841}
2842
2843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2844#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2845#[cfg_attr(feature = "bon", builder(on(String, into)))]
2846pub struct ChatStats {
2847    #[serde(
2848        rename = "unreadCount",
2849        deserialize_with = "deserialize_number_from_string"
2850    )]
2851    pub unread_count: i32,
2852
2853    #[serde(
2854        rename = "unreadMentions",
2855        deserialize_with = "deserialize_number_from_string"
2856    )]
2857    pub unread_mentions: i32,
2858
2859    #[serde(
2860        rename = "reportsCount",
2861        deserialize_with = "deserialize_number_from_string"
2862    )]
2863    pub reports_count: i32,
2864
2865    #[serde(
2866        rename = "minUnreadItemId",
2867        deserialize_with = "deserialize_number_from_string"
2868    )]
2869    pub min_unread_item_id: i64,
2870
2871    #[serde(rename = "unreadChat", default)]
2872    pub unread_chat: bool,
2873
2874    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2875    #[cfg_attr(feature = "bon", builder(default))]
2876    pub undocumented: JsonObject,
2877}
2878
2879/// *Syntax:*
2880///
2881/// ```
2882/// @|#|*|
2883/// ```
2884#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
2885#[non_exhaustive]
2886pub enum ChatType {
2887    #[default]
2888    #[serde(rename = "direct")]
2889    Direct,
2890    #[serde(rename = "group")]
2891    Group,
2892    #[serde(rename = "local")]
2893    Local,
2894}
2895
2896impl CommandSyntax for ChatType {
2897    const COMMAND_BUF_SIZE: usize = 16;
2898
2899    fn append_command_syntax(&self, buf: &mut String) {
2900        match self {
2901            Self::Direct => {
2902                buf.push('@');
2903            }
2904            Self::Group => {
2905                buf.push('#');
2906            }
2907            Self::Local => {
2908                buf.push('*');
2909            }
2910        }
2911    }
2912}
2913
2914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2915#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2916#[cfg_attr(feature = "bon", builder(on(String, into)))]
2917pub struct ChatWallpaper {
2918    #[serde(rename = "preset", skip_serializing_if = "Option::is_none")]
2919    pub preset: Option<String>,
2920
2921    #[serde(rename = "imageFile", skip_serializing_if = "Option::is_none")]
2922    pub image_file: Option<String>,
2923
2924    #[serde(rename = "background", skip_serializing_if = "Option::is_none")]
2925    pub background: Option<String>,
2926
2927    #[serde(rename = "tint", skip_serializing_if = "Option::is_none")]
2928    pub tint: Option<String>,
2929
2930    #[serde(rename = "scaleType", skip_serializing_if = "Option::is_none")]
2931    pub scale_type: Option<ChatWallpaperScale>,
2932
2933    #[serde(
2934        rename = "scale",
2935        skip_serializing_if = "Option::is_none",
2936        deserialize_with = "deserialize_option_number_from_string",
2937        default
2938    )]
2939    pub scale: Option<f64>,
2940
2941    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2942    #[cfg_attr(feature = "bon", builder(default))]
2943    pub undocumented: JsonObject,
2944}
2945
2946#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
2947#[non_exhaustive]
2948pub enum ChatWallpaperScale {
2949    #[default]
2950    #[serde(rename = "fill")]
2951    Fill,
2952    #[serde(rename = "fit")]
2953    Fit,
2954    #[serde(rename = "repeat")]
2955    Repeat,
2956}
2957
2958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2959#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2960#[cfg_attr(feature = "bon", builder(on(String, into)))]
2961pub struct ClientNotice {
2962    #[serde(
2963        rename = "ttl",
2964        skip_serializing_if = "Option::is_none",
2965        deserialize_with = "deserialize_option_number_from_string",
2966        default
2967    )]
2968    pub ttl: Option<i64>,
2969
2970    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2971    #[cfg_attr(feature = "bon", builder(default))]
2972    pub undocumented: JsonObject,
2973}
2974
2975#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
2976#[non_exhaustive]
2977pub enum Color {
2978    #[default]
2979    #[serde(rename = "black")]
2980    Black,
2981    #[serde(rename = "red")]
2982    Red,
2983    #[serde(rename = "green")]
2984    Green,
2985    #[serde(rename = "yellow")]
2986    Yellow,
2987    #[serde(rename = "blue")]
2988    Blue,
2989    #[serde(rename = "magenta")]
2990    Magenta,
2991    #[serde(rename = "cyan")]
2992    Cyan,
2993    #[serde(rename = "white")]
2994    White,
2995}
2996
2997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2998#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2999#[cfg_attr(feature = "bon", builder(on(String, into)))]
3000pub struct CommentsGroupPreference {
3001    #[serde(rename = "enable")]
3002    pub enable: GroupFeatureEnabled,
3003
3004    #[serde(
3005        rename = "duration",
3006        skip_serializing_if = "Option::is_none",
3007        deserialize_with = "deserialize_option_number_from_string",
3008        default
3009    )]
3010    pub duration: Option<i32>,
3011
3012    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3013    #[cfg_attr(feature = "bon", builder(default))]
3014    pub undocumented: JsonObject,
3015}
3016
3017#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3018#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3019#[cfg_attr(feature = "bon", builder(on(String, into)))]
3020pub struct ComposedMessage {
3021    #[serde(rename = "fileSource", skip_serializing_if = "Option::is_none")]
3022    pub file_source: Option<CryptoFile>,
3023
3024    #[serde(
3025        rename = "quotedItemId",
3026        skip_serializing_if = "Option::is_none",
3027        deserialize_with = "deserialize_option_number_from_string",
3028        default
3029    )]
3030    pub quoted_item_id: Option<i64>,
3031
3032    #[serde(rename = "msgContent")]
3033    pub msg_content: MsgContent,
3034
3035    #[serde(rename = "mentions")]
3036    pub mentions: BTreeMap<String, i64>,
3037
3038    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3039    #[cfg_attr(feature = "bon", builder(default))]
3040    pub undocumented: JsonObject,
3041}
3042
3043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3044#[serde(tag = "type")]
3045#[non_exhaustive]
3046pub enum ConnStatus {
3047    #[serde(rename = "new")]
3048    New,
3049    #[serde(rename = "prepared")]
3050    Prepared,
3051    #[serde(rename = "joined")]
3052    Joined,
3053    #[serde(rename = "requested")]
3054    Requested,
3055    #[serde(rename = "accepted")]
3056    Accepted,
3057    #[serde(rename = "sndReady")]
3058    SndReady,
3059    #[serde(rename = "ready")]
3060    Ready,
3061    #[serde(rename = "deleted")]
3062    Deleted,
3063    #[serde(rename = "failed")]
3064    Failed {
3065        #[serde(rename = "connError")]
3066        conn_error: String,
3067
3068        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3069        undocumented: JsonObject,
3070    },
3071    #[serde(untagged)]
3072    Undocumented(JsonObject),
3073}
3074
3075impl ConnStatus {
3076    pub fn make_new() -> Self {
3077        Self::New
3078    }
3079
3080    pub fn make_prepared() -> Self {
3081        Self::Prepared
3082    }
3083
3084    pub fn make_joined() -> Self {
3085        Self::Joined
3086    }
3087
3088    pub fn make_requested() -> Self {
3089        Self::Requested
3090    }
3091
3092    pub fn make_accepted() -> Self {
3093        Self::Accepted
3094    }
3095
3096    pub fn make_snd_ready() -> Self {
3097        Self::SndReady
3098    }
3099
3100    pub fn make_ready() -> Self {
3101        Self::Ready
3102    }
3103
3104    pub fn make_deleted() -> Self {
3105        Self::Deleted
3106    }
3107
3108    pub fn make_failed(conn_error: String) -> Self {
3109        Self::Failed {
3110            conn_error,
3111            undocumented: Default::default(),
3112        }
3113    }
3114}
3115
3116impl ConnStatus {
3117    pub fn is_new(&self) -> bool {
3118        matches!(self, Self::New)
3119    }
3120    pub fn is_prepared(&self) -> bool {
3121        matches!(self, Self::Prepared)
3122    }
3123    pub fn is_joined(&self) -> bool {
3124        matches!(self, Self::Joined)
3125    }
3126    pub fn is_requested(&self) -> bool {
3127        matches!(self, Self::Requested)
3128    }
3129    pub fn is_accepted(&self) -> bool {
3130        matches!(self, Self::Accepted)
3131    }
3132    pub fn is_snd_ready(&self) -> bool {
3133        matches!(self, Self::SndReady)
3134    }
3135    pub fn is_ready(&self) -> bool {
3136        matches!(self, Self::Ready)
3137    }
3138    pub fn is_deleted(&self) -> bool {
3139        matches!(self, Self::Deleted)
3140    }
3141    pub fn failed(&self) -> Option<&String> {
3142        if let Self::Failed { conn_error, .. } = self {
3143            Some(conn_error)
3144        } else {
3145            None
3146        }
3147    }
3148}
3149
3150#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
3151#[non_exhaustive]
3152pub enum ConnType {
3153    #[default]
3154    #[serde(rename = "contact")]
3155    Contact,
3156    #[serde(rename = "member")]
3157    Member,
3158    #[serde(rename = "user_contact")]
3159    UserContact,
3160}
3161
3162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3163#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3164#[cfg_attr(feature = "bon", builder(on(String, into)))]
3165pub struct Connection {
3166    #[serde(rename = "connId", deserialize_with = "deserialize_number_from_string")]
3167    pub conn_id: i64,
3168
3169    #[serde(rename = "agentConnId")]
3170    pub agent_conn_id: String,
3171
3172    #[serde(
3173        rename = "connChatVersion",
3174        deserialize_with = "deserialize_number_from_string"
3175    )]
3176    pub conn_chat_version: i32,
3177
3178    #[serde(rename = "peerChatVRange")]
3179    pub peer_chat_v_range: VersionRange,
3180
3181    #[serde(
3182        rename = "connLevel",
3183        deserialize_with = "deserialize_number_from_string"
3184    )]
3185    pub conn_level: i32,
3186
3187    #[serde(
3188        rename = "viaContact",
3189        skip_serializing_if = "Option::is_none",
3190        deserialize_with = "deserialize_option_number_from_string",
3191        default
3192    )]
3193    pub via_contact: Option<i64>,
3194
3195    #[serde(
3196        rename = "viaUserContactLink",
3197        skip_serializing_if = "Option::is_none",
3198        deserialize_with = "deserialize_option_number_from_string",
3199        default
3200    )]
3201    pub via_user_contact_link: Option<i64>,
3202
3203    #[serde(rename = "viaGroupLink", default)]
3204    pub via_group_link: bool,
3205
3206    #[serde(rename = "groupLinkId", skip_serializing_if = "Option::is_none")]
3207    pub group_link_id: Option<String>,
3208
3209    #[serde(rename = "xContactId", skip_serializing_if = "Option::is_none")]
3210    pub x_contact_id: Option<String>,
3211
3212    #[serde(
3213        rename = "customUserProfileId",
3214        skip_serializing_if = "Option::is_none",
3215        deserialize_with = "deserialize_option_number_from_string",
3216        default
3217    )]
3218    pub custom_user_profile_id: Option<i64>,
3219
3220    #[serde(rename = "connType")]
3221    pub conn_type: ConnType,
3222
3223    #[serde(rename = "connStatus")]
3224    pub conn_status: ConnStatus,
3225
3226    #[serde(rename = "contactConnInitiated", default)]
3227    pub contact_conn_initiated: bool,
3228
3229    #[serde(rename = "localAlias")]
3230    pub local_alias: String,
3231
3232    #[serde(
3233        rename = "entityId",
3234        skip_serializing_if = "Option::is_none",
3235        deserialize_with = "deserialize_option_number_from_string",
3236        default
3237    )]
3238    pub entity_id: Option<i64>,
3239
3240    #[serde(rename = "connectionCode", skip_serializing_if = "Option::is_none")]
3241    pub connection_code: Option<SecurityCode>,
3242
3243    #[serde(rename = "pqSupport", default)]
3244    pub pq_support: bool,
3245
3246    #[serde(rename = "pqEncryption", default)]
3247    pub pq_encryption: bool,
3248
3249    #[serde(rename = "pqSndEnabled", skip_serializing_if = "Option::is_none")]
3250    pub pq_snd_enabled: Option<bool>,
3251
3252    #[serde(rename = "pqRcvEnabled", skip_serializing_if = "Option::is_none")]
3253    pub pq_rcv_enabled: Option<bool>,
3254
3255    #[serde(
3256        rename = "authErrCounter",
3257        deserialize_with = "deserialize_number_from_string"
3258    )]
3259    pub auth_err_counter: i32,
3260
3261    #[serde(
3262        rename = "quotaErrCounter",
3263        deserialize_with = "deserialize_number_from_string"
3264    )]
3265    pub quota_err_counter: i32,
3266
3267    #[serde(rename = "createdAt")]
3268    pub created_at: UtcTime,
3269
3270    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3271    #[cfg_attr(feature = "bon", builder(default))]
3272    pub undocumented: JsonObject,
3273}
3274
3275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3276#[serde(tag = "type")]
3277#[non_exhaustive]
3278pub enum ConnectionEntity {
3279    #[serde(rename = "rcvDirectMsgConnection")]
3280    RcvDirectMsgConnection {
3281        #[serde(rename = "entityConnection")]
3282        entity_connection: Connection,
3283
3284        #[serde(rename = "contact", skip_serializing_if = "Option::is_none")]
3285        contact: Option<Contact>,
3286
3287        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3288        undocumented: JsonObject,
3289    },
3290    #[serde(rename = "rcvGroupMsgConnection")]
3291    RcvGroupMsgConnection {
3292        #[serde(rename = "entityConnection")]
3293        entity_connection: Connection,
3294
3295        #[serde(rename = "groupInfo")]
3296        group_info: GroupInfo,
3297
3298        #[serde(rename = "groupMember")]
3299        group_member: GroupMember,
3300
3301        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3302        undocumented: JsonObject,
3303    },
3304    #[serde(rename = "userContactConnection")]
3305    UserContactConnection {
3306        #[serde(rename = "entityConnection")]
3307        entity_connection: Connection,
3308
3309        #[serde(rename = "userContact")]
3310        user_contact: UserContact,
3311
3312        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3313        undocumented: JsonObject,
3314    },
3315    #[serde(untagged)]
3316    Undocumented(JsonObject),
3317}
3318
3319impl ConnectionEntity {
3320    pub fn make_rcv_direct_msg_connection(
3321        entity_connection: Connection,
3322        contact: Option<Contact>,
3323    ) -> Self {
3324        Self::RcvDirectMsgConnection {
3325            entity_connection,
3326            contact,
3327            undocumented: Default::default(),
3328        }
3329    }
3330
3331    pub fn make_rcv_group_msg_connection(
3332        entity_connection: Connection,
3333        group_info: GroupInfo,
3334        group_member: GroupMember,
3335    ) -> Self {
3336        Self::RcvGroupMsgConnection {
3337            entity_connection,
3338            group_info,
3339            group_member,
3340            undocumented: Default::default(),
3341        }
3342    }
3343
3344    pub fn make_user_contact_connection(
3345        entity_connection: Connection,
3346        user_contact: UserContact,
3347    ) -> Self {
3348        Self::UserContactConnection {
3349            entity_connection,
3350            user_contact,
3351            undocumented: Default::default(),
3352        }
3353    }
3354}
3355
3356impl ConnectionEntity {
3357    pub fn rcv_direct_msg_connection(
3358        &self,
3359    ) -> Option<ConnectionEntityRcvDirectMsgConnectionRef<'_>> {
3360        if let Self::RcvDirectMsgConnection {
3361            entity_connection,
3362            contact,
3363            ..
3364        } = self
3365        {
3366            Some(ConnectionEntityRcvDirectMsgConnectionRef {
3367                entity_connection,
3368                contact,
3369            })
3370        } else {
3371            None
3372        }
3373    }
3374    pub fn rcv_group_msg_connection(&self) -> Option<ConnectionEntityRcvGroupMsgConnectionRef<'_>> {
3375        if let Self::RcvGroupMsgConnection {
3376            entity_connection,
3377            group_info,
3378            group_member,
3379            ..
3380        } = self
3381        {
3382            Some(ConnectionEntityRcvGroupMsgConnectionRef {
3383                entity_connection,
3384                group_info,
3385                group_member,
3386            })
3387        } else {
3388            None
3389        }
3390    }
3391    pub fn user_contact_connection(&self) -> Option<ConnectionEntityUserContactConnectionRef<'_>> {
3392        if let Self::UserContactConnection {
3393            entity_connection,
3394            user_contact,
3395            ..
3396        } = self
3397        {
3398            Some(ConnectionEntityUserContactConnectionRef {
3399                entity_connection,
3400                user_contact,
3401            })
3402        } else {
3403            None
3404        }
3405    }
3406}
3407#[derive(Clone, Copy)]
3408pub struct ConnectionEntityRcvDirectMsgConnectionRef<'a> {
3409    pub entity_connection: &'a Connection,
3410    pub contact: &'a Option<Contact>,
3411}
3412#[derive(Clone, Copy)]
3413pub struct ConnectionEntityRcvGroupMsgConnectionRef<'a> {
3414    pub entity_connection: &'a Connection,
3415    pub group_info: &'a GroupInfo,
3416    pub group_member: &'a GroupMember,
3417}
3418#[derive(Clone, Copy)]
3419pub struct ConnectionEntityUserContactConnectionRef<'a> {
3420    pub entity_connection: &'a Connection,
3421    pub user_contact: &'a UserContact,
3422}
3423
3424#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
3425#[non_exhaustive]
3426pub enum ConnectionMode {
3427    #[default]
3428    #[serde(rename = "inv")]
3429    Inv,
3430    #[serde(rename = "con")]
3431    Con,
3432}
3433
3434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3435#[serde(tag = "type")]
3436#[non_exhaustive]
3437pub enum ConnectionPlan {
3438    #[serde(rename = "invitationLink")]
3439    InvitationLink {
3440        #[serde(rename = "invitationLinkPlan")]
3441        invitation_link_plan: InvitationLinkPlan,
3442
3443        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3444        undocumented: JsonObject,
3445    },
3446    #[serde(rename = "contactAddress")]
3447    ContactAddress {
3448        #[serde(rename = "contactAddressPlan")]
3449        contact_address_plan: ContactAddressPlan,
3450
3451        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3452        undocumented: JsonObject,
3453    },
3454    #[serde(rename = "groupLink")]
3455    GroupLink {
3456        #[serde(rename = "groupLinkPlan")]
3457        group_link_plan: GroupLinkPlan,
3458
3459        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3460        undocumented: JsonObject,
3461    },
3462    #[serde(rename = "error")]
3463    Error {
3464        #[serde(rename = "chatError")]
3465        chat_error: ChatError,
3466
3467        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3468        undocumented: JsonObject,
3469    },
3470    #[serde(untagged)]
3471    Undocumented(JsonObject),
3472}
3473
3474impl ConnectionPlan {
3475    pub fn make_invitation_link(invitation_link_plan: InvitationLinkPlan) -> Self {
3476        Self::InvitationLink {
3477            invitation_link_plan,
3478            undocumented: Default::default(),
3479        }
3480    }
3481
3482    pub fn make_contact_address(contact_address_plan: ContactAddressPlan) -> Self {
3483        Self::ContactAddress {
3484            contact_address_plan,
3485            undocumented: Default::default(),
3486        }
3487    }
3488
3489    pub fn make_group_link(group_link_plan: GroupLinkPlan) -> Self {
3490        Self::GroupLink {
3491            group_link_plan,
3492            undocumented: Default::default(),
3493        }
3494    }
3495
3496    pub fn make_error(chat_error: ChatError) -> Self {
3497        Self::Error {
3498            chat_error,
3499            undocumented: Default::default(),
3500        }
3501    }
3502}
3503
3504impl ConnectionPlan {
3505    pub fn invitation_link(&self) -> Option<&InvitationLinkPlan> {
3506        if let Self::InvitationLink {
3507            invitation_link_plan,
3508            ..
3509        } = self
3510        {
3511            Some(invitation_link_plan)
3512        } else {
3513            None
3514        }
3515    }
3516    pub fn contact_address(&self) -> Option<&ContactAddressPlan> {
3517        if let Self::ContactAddress {
3518            contact_address_plan,
3519            ..
3520        } = self
3521        {
3522            Some(contact_address_plan)
3523        } else {
3524            None
3525        }
3526    }
3527    pub fn group_link(&self) -> Option<&GroupLinkPlan> {
3528        if let Self::GroupLink {
3529            group_link_plan, ..
3530        } = self
3531        {
3532            Some(group_link_plan)
3533        } else {
3534            None
3535        }
3536    }
3537    pub fn error(&self) -> Option<&ChatError> {
3538        if let Self::Error { chat_error, .. } = self {
3539            Some(chat_error)
3540        } else {
3541            None
3542        }
3543    }
3544}
3545
3546#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3547#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3548#[cfg_attr(feature = "bon", builder(on(String, into)))]
3549pub struct Contact {
3550    #[serde(
3551        rename = "contactId",
3552        deserialize_with = "deserialize_number_from_string"
3553    )]
3554    pub contact_id: i64,
3555
3556    #[serde(rename = "localDisplayName")]
3557    pub local_display_name: String,
3558
3559    #[serde(rename = "profile")]
3560    pub profile: LocalProfile,
3561
3562    #[serde(rename = "activeConn", skip_serializing_if = "Option::is_none")]
3563    pub active_conn: Option<Connection>,
3564
3565    #[serde(rename = "contactUsed", default)]
3566    pub contact_used: bool,
3567
3568    #[serde(rename = "contactStatus")]
3569    pub contact_status: ContactStatus,
3570
3571    #[serde(rename = "chatSettings")]
3572    pub chat_settings: ChatSettings,
3573
3574    #[serde(rename = "userPreferences")]
3575    pub user_preferences: Preferences,
3576
3577    #[serde(rename = "mergedPreferences")]
3578    pub merged_preferences: ContactUserPreferences,
3579
3580    #[serde(rename = "createdAt")]
3581    pub created_at: UtcTime,
3582
3583    #[serde(rename = "updatedAt")]
3584    pub updated_at: UtcTime,
3585
3586    #[serde(rename = "chatTs", skip_serializing_if = "Option::is_none")]
3587    pub chat_ts: Option<UtcTime>,
3588
3589    #[serde(rename = "preparedContact", skip_serializing_if = "Option::is_none")]
3590    pub prepared_contact: Option<PreparedContact>,
3591
3592    #[serde(
3593        rename = "contactRequestId",
3594        skip_serializing_if = "Option::is_none",
3595        deserialize_with = "deserialize_option_number_from_string",
3596        default
3597    )]
3598    pub contact_request_id: Option<i64>,
3599
3600    #[serde(
3601        rename = "contactGroupMemberId",
3602        skip_serializing_if = "Option::is_none",
3603        deserialize_with = "deserialize_option_number_from_string",
3604        default
3605    )]
3606    pub contact_group_member_id: Option<i64>,
3607
3608    #[serde(rename = "contactGrpInvSent", default)]
3609    pub contact_grp_inv_sent: bool,
3610
3611    #[serde(rename = "groupDirectInv", skip_serializing_if = "Option::is_none")]
3612    pub group_direct_inv: Option<GroupDirectInvitation>,
3613
3614    #[serde(rename = "chatTags")]
3615    pub chat_tags: Vec<i64>,
3616
3617    #[serde(
3618        rename = "chatItemTTL",
3619        skip_serializing_if = "Option::is_none",
3620        deserialize_with = "deserialize_option_number_from_string",
3621        default
3622    )]
3623    pub chat_item_ttl: Option<i64>,
3624
3625    #[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
3626    pub ui_themes: Option<UIThemeEntityOverrides>,
3627
3628    #[serde(rename = "chatDeleted", default)]
3629    pub chat_deleted: bool,
3630
3631    #[serde(rename = "customData", skip_serializing_if = "Option::is_none")]
3632    pub custom_data: Option<JsonObject>,
3633
3634    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3635    #[cfg_attr(feature = "bon", builder(default))]
3636    pub undocumented: JsonObject,
3637}
3638
3639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3640#[serde(tag = "type")]
3641#[non_exhaustive]
3642pub enum ContactAddressPlan {
3643    #[serde(rename = "ok")]
3644    Ok {
3645        #[serde(rename = "contactSLinkData_", skip_serializing_if = "Option::is_none")]
3646        contact_s_link_data: Option<ContactShortLinkData>,
3647
3648        #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
3649        owner_verification: Option<OwnerVerification>,
3650
3651        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3652        undocumented: JsonObject,
3653    },
3654    #[serde(rename = "ownLink")]
3655    OwnLink,
3656    #[serde(rename = "connectingConfirmReconnect")]
3657    ConnectingConfirmReconnect,
3658    #[serde(rename = "connectingProhibit")]
3659    ConnectingProhibit {
3660        #[serde(rename = "contact")]
3661        contact: Contact,
3662
3663        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3664        undocumented: JsonObject,
3665    },
3666    #[serde(rename = "known")]
3667    Known {
3668        #[serde(rename = "contact")]
3669        contact: Contact,
3670
3671        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3672        undocumented: JsonObject,
3673    },
3674    #[serde(rename = "contactViaAddress")]
3675    ContactViaAddress {
3676        #[serde(rename = "contact")]
3677        contact: Contact,
3678
3679        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3680        undocumented: JsonObject,
3681    },
3682    #[serde(untagged)]
3683    Undocumented(JsonObject),
3684}
3685
3686impl ContactAddressPlan {
3687    pub fn make_ok(
3688        contact_s_link_data: Option<ContactShortLinkData>,
3689        owner_verification: Option<OwnerVerification>,
3690    ) -> Self {
3691        Self::Ok {
3692            contact_s_link_data,
3693            owner_verification,
3694            undocumented: Default::default(),
3695        }
3696    }
3697
3698    pub fn make_own_link() -> Self {
3699        Self::OwnLink
3700    }
3701
3702    pub fn make_connecting_confirm_reconnect() -> Self {
3703        Self::ConnectingConfirmReconnect
3704    }
3705
3706    pub fn make_connecting_prohibit(contact: Contact) -> Self {
3707        Self::ConnectingProhibit {
3708            contact,
3709            undocumented: Default::default(),
3710        }
3711    }
3712
3713    pub fn make_known(contact: Contact) -> Self {
3714        Self::Known {
3715            contact,
3716            undocumented: Default::default(),
3717        }
3718    }
3719
3720    pub fn make_contact_via_address(contact: Contact) -> Self {
3721        Self::ContactViaAddress {
3722            contact,
3723            undocumented: Default::default(),
3724        }
3725    }
3726}
3727
3728impl ContactAddressPlan {
3729    pub fn ok(&self) -> Option<ContactAddressPlanOkRef<'_>> {
3730        if let Self::Ok {
3731            contact_s_link_data,
3732            owner_verification,
3733            ..
3734        } = self
3735        {
3736            Some(ContactAddressPlanOkRef {
3737                contact_s_link_data,
3738                owner_verification,
3739            })
3740        } else {
3741            None
3742        }
3743    }
3744    pub fn is_own_link(&self) -> bool {
3745        matches!(self, Self::OwnLink)
3746    }
3747    pub fn is_connecting_confirm_reconnect(&self) -> bool {
3748        matches!(self, Self::ConnectingConfirmReconnect)
3749    }
3750    pub fn connecting_prohibit(&self) -> Option<&Contact> {
3751        if let Self::ConnectingProhibit { contact, .. } = self {
3752            Some(contact)
3753        } else {
3754            None
3755        }
3756    }
3757    pub fn known(&self) -> Option<&Contact> {
3758        if let Self::Known { contact, .. } = self {
3759            Some(contact)
3760        } else {
3761            None
3762        }
3763    }
3764    pub fn contact_via_address(&self) -> Option<&Contact> {
3765        if let Self::ContactViaAddress { contact, .. } = self {
3766            Some(contact)
3767        } else {
3768            None
3769        }
3770    }
3771}
3772#[derive(Clone, Copy)]
3773pub struct ContactAddressPlanOkRef<'a> {
3774    pub contact_s_link_data: &'a Option<ContactShortLinkData>,
3775    pub owner_verification: &'a Option<OwnerVerification>,
3776}
3777
3778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3779#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3780#[cfg_attr(feature = "bon", builder(on(String, into)))]
3781pub struct ContactShortLinkData {
3782    #[serde(rename = "profile")]
3783    pub profile: Profile,
3784
3785    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
3786    pub message: Option<MsgContent>,
3787
3788    #[serde(rename = "business", default)]
3789    pub business: bool,
3790
3791    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3792    #[cfg_attr(feature = "bon", builder(default))]
3793    pub undocumented: JsonObject,
3794}
3795
3796#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
3797#[non_exhaustive]
3798pub enum ContactStatus {
3799    #[default]
3800    #[serde(rename = "active")]
3801    Active,
3802    #[serde(rename = "deleted")]
3803    Deleted,
3804    #[serde(rename = "deletedByUser")]
3805    DeletedByUser,
3806}
3807
3808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3809#[serde(tag = "type")]
3810#[non_exhaustive]
3811pub enum ContactUserPref {
3812    #[serde(rename = "contact")]
3813    Contact {
3814        #[serde(rename = "preference")]
3815        preference: SimplePreference,
3816
3817        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3818        undocumented: JsonObject,
3819    },
3820    #[serde(rename = "user")]
3821    User {
3822        #[serde(rename = "preference")]
3823        preference: SimplePreference,
3824
3825        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3826        undocumented: JsonObject,
3827    },
3828    #[serde(untagged)]
3829    Undocumented(JsonObject),
3830}
3831
3832impl ContactUserPref {
3833    pub fn make_contact(preference: SimplePreference) -> Self {
3834        Self::Contact {
3835            preference,
3836            undocumented: Default::default(),
3837        }
3838    }
3839
3840    pub fn make_user(preference: SimplePreference) -> Self {
3841        Self::User {
3842            preference,
3843            undocumented: Default::default(),
3844        }
3845    }
3846}
3847
3848impl ContactUserPref {
3849    pub fn contact(&self) -> Option<&SimplePreference> {
3850        if let Self::Contact { preference, .. } = self {
3851            Some(preference)
3852        } else {
3853            None
3854        }
3855    }
3856    pub fn user(&self) -> Option<&SimplePreference> {
3857        if let Self::User { preference, .. } = self {
3858            Some(preference)
3859        } else {
3860            None
3861        }
3862    }
3863}
3864
3865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3866#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3867#[cfg_attr(feature = "bon", builder(on(String, into)))]
3868pub struct ContactUserPreference {
3869    #[serde(rename = "enabled")]
3870    pub enabled: PrefEnabled,
3871
3872    #[serde(rename = "userPreference")]
3873    pub user_preference: ContactUserPref,
3874
3875    #[serde(rename = "contactPreference")]
3876    pub contact_preference: SimplePreference,
3877
3878    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3879    #[cfg_attr(feature = "bon", builder(default))]
3880    pub undocumented: JsonObject,
3881}
3882
3883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3884#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3885#[cfg_attr(feature = "bon", builder(on(String, into)))]
3886pub struct ContactUserPreferences {
3887    #[serde(rename = "timedMessages")]
3888    pub timed_messages: ContactUserPreference,
3889
3890    #[serde(rename = "fullDelete")]
3891    pub full_delete: ContactUserPreference,
3892
3893    #[serde(rename = "reactions")]
3894    pub reactions: ContactUserPreference,
3895
3896    #[serde(rename = "voice")]
3897    pub voice: ContactUserPreference,
3898
3899    #[serde(rename = "files")]
3900    pub files: ContactUserPreference,
3901
3902    #[serde(rename = "calls")]
3903    pub calls: ContactUserPreference,
3904
3905    #[serde(rename = "sessions")]
3906    pub sessions: ContactUserPreference,
3907
3908    #[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
3909    pub commands: Option<Vec<ChatBotCommand>>,
3910
3911    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3912    #[cfg_attr(feature = "bon", builder(default))]
3913    pub undocumented: JsonObject,
3914}
3915
3916/// *Syntax:*
3917///
3918/// ```
3919/// <connFullLink>[ <connShortLink>]
3920/// ```
3921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3922#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3923#[cfg_attr(feature = "bon", builder(on(String, into)))]
3924pub struct CreatedConnLink {
3925    #[serde(rename = "connFullLink")]
3926    pub conn_full_link: String,
3927
3928    #[serde(rename = "connShortLink", skip_serializing_if = "Option::is_none")]
3929    pub conn_short_link: Option<String>,
3930
3931    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3932    #[cfg_attr(feature = "bon", builder(default))]
3933    pub undocumented: JsonObject,
3934}
3935
3936impl CommandSyntax for CreatedConnLink {
3937    const COMMAND_BUF_SIZE: usize = 64;
3938
3939    fn append_command_syntax(&self, buf: &mut String) {
3940        write!(buf, "{}", self.conn_full_link).unwrap();
3941        if let Some(conn_short_link) = &self.conn_short_link {
3942            buf.push(' ');
3943            write!(buf, "{}", conn_short_link).unwrap();
3944        }
3945    }
3946}
3947
3948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3949#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3950#[cfg_attr(feature = "bon", builder(on(String, into)))]
3951pub struct CryptoFile {
3952    #[serde(rename = "filePath")]
3953    pub file_path: String,
3954
3955    #[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
3956    pub crypto_args: Option<CryptoFileArgs>,
3957
3958    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3959    #[cfg_attr(feature = "bon", builder(default))]
3960    pub undocumented: JsonObject,
3961}
3962
3963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3964#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3965#[cfg_attr(feature = "bon", builder(on(String, into)))]
3966pub struct CryptoFileArgs {
3967    #[serde(rename = "fileKey")]
3968    pub file_key: String,
3969
3970    #[serde(rename = "fileNonce")]
3971    pub file_nonce: String,
3972
3973    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3974    #[cfg_attr(feature = "bon", builder(default))]
3975    pub undocumented: JsonObject,
3976}
3977
3978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3979#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3980#[cfg_attr(feature = "bon", builder(on(String, into)))]
3981pub struct DroppedMsg {
3982    #[serde(rename = "brokerTs")]
3983    pub broker_ts: UtcTime,
3984
3985    #[serde(
3986        rename = "attempts",
3987        deserialize_with = "deserialize_number_from_string"
3988    )]
3989    pub attempts: i32,
3990
3991    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3992    #[cfg_attr(feature = "bon", builder(default))]
3993    pub undocumented: JsonObject,
3994}
3995
3996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3997#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3998#[cfg_attr(feature = "bon", builder(on(String, into)))]
3999pub struct E2EInfo {
4000    #[serde(rename = "public", skip_serializing_if = "Option::is_none")]
4001    pub public: Option<bool>,
4002
4003    #[serde(rename = "pqEnabled", skip_serializing_if = "Option::is_none")]
4004    pub pq_enabled: Option<bool>,
4005
4006    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4007    #[cfg_attr(feature = "bon", builder(default))]
4008    pub undocumented: JsonObject,
4009}
4010
4011#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4012#[non_exhaustive]
4013pub enum FeatureAllowed {
4014    #[default]
4015    #[serde(rename = "always")]
4016    Always,
4017    #[serde(rename = "yes")]
4018    Yes,
4019    #[serde(rename = "no")]
4020    No,
4021}
4022
4023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4024#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4025#[cfg_attr(feature = "bon", builder(on(String, into)))]
4026pub struct FileDescr {
4027    #[serde(rename = "fileDescrText")]
4028    pub file_descr_text: String,
4029
4030    #[serde(
4031        rename = "fileDescrPartNo",
4032        deserialize_with = "deserialize_number_from_string"
4033    )]
4034    pub file_descr_part_no: i32,
4035
4036    #[serde(rename = "fileDescrComplete", default)]
4037    pub file_descr_complete: bool,
4038
4039    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4040    #[cfg_attr(feature = "bon", builder(default))]
4041    pub undocumented: JsonObject,
4042}
4043
4044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4045#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4046#[cfg_attr(feature = "bon", builder(on(String, into)))]
4047pub struct FileInvitation {
4048    #[serde(rename = "fileName")]
4049    pub file_name: String,
4050
4051    #[serde(
4052        rename = "fileSize",
4053        deserialize_with = "deserialize_number_from_string"
4054    )]
4055    pub file_size: i64,
4056
4057    #[serde(rename = "fileDigest", skip_serializing_if = "Option::is_none")]
4058    pub file_digest: Option<String>,
4059
4060    #[serde(rename = "fileConnReq", skip_serializing_if = "Option::is_none")]
4061    pub file_conn_req: Option<String>,
4062
4063    #[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
4064    pub file_inline: Option<InlineFileMode>,
4065
4066    #[serde(rename = "fileDescr", skip_serializing_if = "Option::is_none")]
4067    pub file_descr: Option<FileDescr>,
4068
4069    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4070    #[cfg_attr(feature = "bon", builder(default))]
4071    pub undocumented: JsonObject,
4072}
4073
4074#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4075#[non_exhaustive]
4076pub enum FileProtocol {
4077    #[default]
4078    #[serde(rename = "smp")]
4079    Smp,
4080    #[serde(rename = "xftp")]
4081    Xftp,
4082    #[serde(rename = "local")]
4083    Local,
4084}
4085
4086#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4087#[non_exhaustive]
4088pub enum FileStatus {
4089    #[default]
4090    #[serde(rename = "new")]
4091    New,
4092    #[serde(rename = "accepted")]
4093    Accepted,
4094    #[serde(rename = "connected")]
4095    Connected,
4096    #[serde(rename = "complete")]
4097    Complete,
4098    #[serde(rename = "cancelled")]
4099    Cancelled,
4100}
4101
4102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4103#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4104#[cfg_attr(feature = "bon", builder(on(String, into)))]
4105pub struct FileTransferMeta {
4106    #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
4107    pub file_id: i64,
4108
4109    #[serde(rename = "xftpSndFile", skip_serializing_if = "Option::is_none")]
4110    pub xftp_snd_file: Option<XFTPSndFile>,
4111
4112    #[serde(
4113        rename = "xftpRedirectFor",
4114        skip_serializing_if = "Option::is_none",
4115        deserialize_with = "deserialize_option_number_from_string",
4116        default
4117    )]
4118    pub xftp_redirect_for: Option<i64>,
4119
4120    #[serde(rename = "fileName")]
4121    pub file_name: String,
4122
4123    #[serde(rename = "filePath")]
4124    pub file_path: String,
4125
4126    #[serde(
4127        rename = "fileSize",
4128        deserialize_with = "deserialize_number_from_string"
4129    )]
4130    pub file_size: i64,
4131
4132    #[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
4133    pub file_inline: Option<InlineFileMode>,
4134
4135    #[serde(
4136        rename = "chunkSize",
4137        deserialize_with = "deserialize_number_from_string"
4138    )]
4139    pub chunk_size: i64,
4140
4141    #[serde(rename = "cancelled", default)]
4142    pub cancelled: bool,
4143
4144    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4145    #[cfg_attr(feature = "bon", builder(default))]
4146    pub undocumented: JsonObject,
4147}
4148
4149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4150#[serde(tag = "type")]
4151#[non_exhaustive]
4152pub enum Format {
4153    #[serde(rename = "bold")]
4154    Bold,
4155    #[serde(rename = "italic")]
4156    Italic,
4157    #[serde(rename = "strikeThrough")]
4158    StrikeThrough,
4159    #[serde(rename = "snippet")]
4160    Snippet,
4161    #[serde(rename = "secret")]
4162    Secret,
4163    #[serde(rename = "small")]
4164    Small,
4165    #[serde(rename = "colored")]
4166    Colored {
4167        #[serde(rename = "color")]
4168        color: Color,
4169
4170        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4171        undocumented: JsonObject,
4172    },
4173    #[serde(rename = "uri")]
4174    Uri,
4175    #[serde(rename = "hyperLink")]
4176    HyperLink {
4177        #[serde(rename = "showText", skip_serializing_if = "Option::is_none")]
4178        show_text: Option<String>,
4179
4180        #[serde(rename = "linkUri")]
4181        link_uri: String,
4182
4183        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4184        undocumented: JsonObject,
4185    },
4186    #[serde(rename = "simplexLink")]
4187    SimplexLink {
4188        #[serde(rename = "showText", skip_serializing_if = "Option::is_none")]
4189        show_text: Option<String>,
4190
4191        #[serde(rename = "linkType")]
4192        link_type: SimplexLinkType,
4193
4194        #[serde(rename = "simplexUri")]
4195        simplex_uri: String,
4196
4197        #[serde(rename = "smpHosts")]
4198        smp_hosts: Vec<String>,
4199
4200        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4201        undocumented: JsonObject,
4202    },
4203    #[serde(rename = "simplexName")]
4204    SimplexName {
4205        #[serde(rename = "nameInfo")]
4206        name_info: SimplexNameInfo,
4207
4208        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4209        undocumented: JsonObject,
4210    },
4211    #[serde(rename = "command")]
4212    Command {
4213        #[serde(rename = "commandStr")]
4214        command_str: String,
4215
4216        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4217        undocumented: JsonObject,
4218    },
4219    #[serde(rename = "mention")]
4220    Mention {
4221        #[serde(rename = "memberName")]
4222        member_name: String,
4223
4224        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4225        undocumented: JsonObject,
4226    },
4227    #[serde(rename = "email")]
4228    Email,
4229    #[serde(rename = "phone")]
4230    Phone,
4231    #[serde(untagged)]
4232    Undocumented(JsonObject),
4233}
4234
4235impl Format {
4236    pub fn make_bold() -> Self {
4237        Self::Bold
4238    }
4239
4240    pub fn make_italic() -> Self {
4241        Self::Italic
4242    }
4243
4244    pub fn make_strike_through() -> Self {
4245        Self::StrikeThrough
4246    }
4247
4248    pub fn make_snippet() -> Self {
4249        Self::Snippet
4250    }
4251
4252    pub fn make_secret() -> Self {
4253        Self::Secret
4254    }
4255
4256    pub fn make_small() -> Self {
4257        Self::Small
4258    }
4259
4260    pub fn make_colored(color: Color) -> Self {
4261        Self::Colored {
4262            color,
4263            undocumented: Default::default(),
4264        }
4265    }
4266
4267    pub fn make_uri() -> Self {
4268        Self::Uri
4269    }
4270
4271    pub fn make_hyper_link(show_text: Option<String>, link_uri: String) -> Self {
4272        Self::HyperLink {
4273            show_text,
4274            link_uri,
4275            undocumented: Default::default(),
4276        }
4277    }
4278
4279    pub fn make_simplex_link(
4280        show_text: Option<String>,
4281        link_type: SimplexLinkType,
4282        simplex_uri: String,
4283        smp_hosts: Vec<String>,
4284    ) -> Self {
4285        Self::SimplexLink {
4286            show_text,
4287            link_type,
4288            simplex_uri,
4289            smp_hosts,
4290            undocumented: Default::default(),
4291        }
4292    }
4293
4294    pub fn make_simplex_name(name_info: SimplexNameInfo) -> Self {
4295        Self::SimplexName {
4296            name_info,
4297            undocumented: Default::default(),
4298        }
4299    }
4300
4301    pub fn make_command(command_str: String) -> Self {
4302        Self::Command {
4303            command_str,
4304            undocumented: Default::default(),
4305        }
4306    }
4307
4308    pub fn make_mention(member_name: String) -> Self {
4309        Self::Mention {
4310            member_name,
4311            undocumented: Default::default(),
4312        }
4313    }
4314
4315    pub fn make_email() -> Self {
4316        Self::Email
4317    }
4318
4319    pub fn make_phone() -> Self {
4320        Self::Phone
4321    }
4322}
4323
4324impl Format {
4325    pub fn is_bold(&self) -> bool {
4326        matches!(self, Self::Bold)
4327    }
4328    pub fn is_italic(&self) -> bool {
4329        matches!(self, Self::Italic)
4330    }
4331    pub fn is_strike_through(&self) -> bool {
4332        matches!(self, Self::StrikeThrough)
4333    }
4334    pub fn is_snippet(&self) -> bool {
4335        matches!(self, Self::Snippet)
4336    }
4337    pub fn is_secret(&self) -> bool {
4338        matches!(self, Self::Secret)
4339    }
4340    pub fn is_small(&self) -> bool {
4341        matches!(self, Self::Small)
4342    }
4343    pub fn colored(&self) -> Option<&Color> {
4344        if let Self::Colored { color, .. } = self {
4345            Some(color)
4346        } else {
4347            None
4348        }
4349    }
4350    pub fn is_uri(&self) -> bool {
4351        matches!(self, Self::Uri)
4352    }
4353    pub fn hyper_link(&self) -> Option<FormatHyperLinkRef<'_>> {
4354        if let Self::HyperLink {
4355            show_text,
4356            link_uri,
4357            ..
4358        } = self
4359        {
4360            Some(FormatHyperLinkRef {
4361                show_text,
4362                link_uri,
4363            })
4364        } else {
4365            None
4366        }
4367    }
4368    pub fn simplex_link(&self) -> Option<FormatSimplexLinkRef<'_>> {
4369        if let Self::SimplexLink {
4370            show_text,
4371            link_type,
4372            simplex_uri,
4373            smp_hosts,
4374            ..
4375        } = self
4376        {
4377            Some(FormatSimplexLinkRef {
4378                show_text,
4379                link_type,
4380                simplex_uri,
4381                smp_hosts,
4382            })
4383        } else {
4384            None
4385        }
4386    }
4387    pub fn simplex_name(&self) -> Option<&SimplexNameInfo> {
4388        if let Self::SimplexName { name_info, .. } = self {
4389            Some(name_info)
4390        } else {
4391            None
4392        }
4393    }
4394    pub fn command(&self) -> Option<&String> {
4395        if let Self::Command { command_str, .. } = self {
4396            Some(command_str)
4397        } else {
4398            None
4399        }
4400    }
4401    pub fn mention(&self) -> Option<&String> {
4402        if let Self::Mention { member_name, .. } = self {
4403            Some(member_name)
4404        } else {
4405            None
4406        }
4407    }
4408    pub fn is_email(&self) -> bool {
4409        matches!(self, Self::Email)
4410    }
4411    pub fn is_phone(&self) -> bool {
4412        matches!(self, Self::Phone)
4413    }
4414}
4415#[derive(Clone, Copy)]
4416pub struct FormatHyperLinkRef<'a> {
4417    pub show_text: &'a Option<String>,
4418    pub link_uri: &'a String,
4419}
4420#[derive(Clone, Copy)]
4421pub struct FormatSimplexLinkRef<'a> {
4422    pub show_text: &'a Option<String>,
4423    pub link_type: &'a SimplexLinkType,
4424    pub simplex_uri: &'a String,
4425    pub smp_hosts: &'a Vec<String>,
4426}
4427
4428#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4429#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4430#[cfg_attr(feature = "bon", builder(on(String, into)))]
4431pub struct FormattedText {
4432    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
4433    pub format: Option<Format>,
4434
4435    #[serde(rename = "text")]
4436    pub text: String,
4437
4438    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4439    #[cfg_attr(feature = "bon", builder(default))]
4440    pub undocumented: JsonObject,
4441}
4442
4443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4444#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4445#[cfg_attr(feature = "bon", builder(on(String, into)))]
4446pub struct FullGroupPreferences {
4447    #[serde(rename = "timedMessages")]
4448    pub timed_messages: TimedMessagesGroupPreference,
4449
4450    #[serde(rename = "directMessages")]
4451    pub direct_messages: RoleGroupPreference,
4452
4453    #[serde(rename = "fullDelete")]
4454    pub full_delete: GroupPreference,
4455
4456    #[serde(rename = "reactions")]
4457    pub reactions: GroupPreference,
4458
4459    #[serde(rename = "voice")]
4460    pub voice: RoleGroupPreference,
4461
4462    #[serde(rename = "files")]
4463    pub files: RoleGroupPreference,
4464
4465    #[serde(rename = "simplexLinks")]
4466    pub simplex_links: RoleGroupPreference,
4467
4468    #[serde(rename = "reports")]
4469    pub reports: GroupPreference,
4470
4471    #[serde(rename = "history")]
4472    pub history: GroupPreference,
4473
4474    #[serde(rename = "support")]
4475    pub support: SupportGroupPreference,
4476
4477    #[serde(rename = "sessions")]
4478    pub sessions: RoleGroupPreference,
4479
4480    #[serde(rename = "comments")]
4481    pub comments: CommentsGroupPreference,
4482
4483    #[serde(rename = "commands")]
4484    pub commands: Vec<ChatBotCommand>,
4485
4486    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4487    #[cfg_attr(feature = "bon", builder(default))]
4488    pub undocumented: JsonObject,
4489}
4490
4491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4492#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4493#[cfg_attr(feature = "bon", builder(on(String, into)))]
4494pub struct FullPreferences {
4495    #[serde(rename = "timedMessages")]
4496    pub timed_messages: TimedMessagesPreference,
4497
4498    #[serde(rename = "fullDelete")]
4499    pub full_delete: SimplePreference,
4500
4501    #[serde(rename = "reactions")]
4502    pub reactions: SimplePreference,
4503
4504    #[serde(rename = "voice")]
4505    pub voice: SimplePreference,
4506
4507    #[serde(rename = "files")]
4508    pub files: SimplePreference,
4509
4510    #[serde(rename = "calls")]
4511    pub calls: SimplePreference,
4512
4513    #[serde(rename = "sessions")]
4514    pub sessions: SimplePreference,
4515
4516    #[serde(rename = "commands")]
4517    pub commands: Vec<ChatBotCommand>,
4518
4519    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4520    #[cfg_attr(feature = "bon", builder(default))]
4521    pub undocumented: JsonObject,
4522}
4523
4524#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4525#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4526#[cfg_attr(feature = "bon", builder(on(String, into)))]
4527pub struct Group {
4528    #[serde(rename = "groupInfo")]
4529    pub group_info: GroupInfo,
4530
4531    #[serde(rename = "members")]
4532    pub members: Vec<GroupMember>,
4533
4534    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4535    #[cfg_attr(feature = "bon", builder(default))]
4536    pub undocumented: JsonObject,
4537}
4538
4539/// *Syntax:*
4540///
4541/// ```
4542/// (_support[:<groupMemberId_>])
4543/// ```
4544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4545#[serde(tag = "type")]
4546#[non_exhaustive]
4547pub enum GroupChatScope {
4548    #[serde(rename = "memberSupport")]
4549    MemberSupport {
4550        #[serde(
4551            rename = "groupMemberId_",
4552            skip_serializing_if = "Option::is_none",
4553            deserialize_with = "deserialize_option_number_from_string",
4554            default
4555        )]
4556        group_member_id: Option<i64>,
4557
4558        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4559        undocumented: JsonObject,
4560    },
4561    #[serde(untagged)]
4562    Undocumented(JsonObject),
4563}
4564
4565impl CommandSyntax for GroupChatScope {
4566    const COMMAND_BUF_SIZE: usize = 64;
4567
4568    fn append_command_syntax(&self, buf: &mut String) {
4569        buf.push_str("(_support");
4570        match self {
4571            Self::MemberSupport {
4572                group_member_id, ..
4573            } => {
4574                if let Some(group_member_id) = group_member_id {
4575                    buf.push(':');
4576                    write!(buf, "{}", group_member_id).unwrap();
4577                }
4578            }
4579            Self::Undocumented(_) => {}
4580        }
4581        buf.push(')');
4582    }
4583}
4584
4585impl GroupChatScope {
4586    pub fn make_member_support(group_member_id: Option<i64>) -> Self {
4587        Self::MemberSupport {
4588            group_member_id,
4589            undocumented: Default::default(),
4590        }
4591    }
4592}
4593
4594impl GroupChatScope {
4595    pub fn member_support(&self) -> Option<&Option<i64>> {
4596        if let Self::MemberSupport {
4597            group_member_id, ..
4598        } = self
4599        {
4600            Some(group_member_id)
4601        } else {
4602            None
4603        }
4604    }
4605}
4606
4607#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4608#[serde(tag = "type")]
4609#[non_exhaustive]
4610pub enum GroupChatScopeInfo {
4611    #[serde(rename = "memberSupport")]
4612    MemberSupport {
4613        #[serde(rename = "groupMember_", skip_serializing_if = "Option::is_none")]
4614        group_member: Option<GroupMember>,
4615
4616        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4617        undocumented: JsonObject,
4618    },
4619    #[serde(untagged)]
4620    Undocumented(JsonObject),
4621}
4622
4623impl GroupChatScopeInfo {
4624    pub fn make_member_support(group_member: Option<GroupMember>) -> Self {
4625        Self::MemberSupport {
4626            group_member,
4627            undocumented: Default::default(),
4628        }
4629    }
4630}
4631
4632impl GroupChatScopeInfo {
4633    pub fn member_support(&self) -> Option<&Option<GroupMember>> {
4634        if let Self::MemberSupport { group_member, .. } = self {
4635            Some(group_member)
4636        } else {
4637            None
4638        }
4639    }
4640}
4641
4642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4643#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4644#[cfg_attr(feature = "bon", builder(on(String, into)))]
4645pub struct GroupDirectInvitation {
4646    #[serde(rename = "groupDirectInvLink")]
4647    pub group_direct_inv_link: String,
4648
4649    #[serde(
4650        rename = "fromGroupId_",
4651        skip_serializing_if = "Option::is_none",
4652        deserialize_with = "deserialize_option_number_from_string",
4653        default
4654    )]
4655    pub from_group_id: Option<i64>,
4656
4657    #[serde(
4658        rename = "fromGroupMemberId_",
4659        skip_serializing_if = "Option::is_none",
4660        deserialize_with = "deserialize_option_number_from_string",
4661        default
4662    )]
4663    pub from_group_member_id: Option<i64>,
4664
4665    #[serde(
4666        rename = "fromGroupMemberConnId_",
4667        skip_serializing_if = "Option::is_none",
4668        deserialize_with = "deserialize_option_number_from_string",
4669        default
4670    )]
4671    pub from_group_member_conn_id: Option<i64>,
4672
4673    #[serde(rename = "groupDirectInvStartedConnection", default)]
4674    pub group_direct_inv_started_connection: bool,
4675
4676    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4677    #[cfg_attr(feature = "bon", builder(default))]
4678    pub undocumented: JsonObject,
4679}
4680
4681#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4682#[non_exhaustive]
4683pub enum GroupFeature {
4684    #[default]
4685    #[serde(rename = "timedMessages")]
4686    TimedMessages,
4687    #[serde(rename = "directMessages")]
4688    DirectMessages,
4689    #[serde(rename = "fullDelete")]
4690    FullDelete,
4691    #[serde(rename = "reactions")]
4692    Reactions,
4693    #[serde(rename = "voice")]
4694    Voice,
4695    #[serde(rename = "files")]
4696    Files,
4697    #[serde(rename = "simplexLinks")]
4698    SimplexLinks,
4699    #[serde(rename = "reports")]
4700    Reports,
4701    #[serde(rename = "history")]
4702    History,
4703    #[serde(rename = "support")]
4704    Support,
4705    #[serde(rename = "sessions")]
4706    Sessions,
4707    #[serde(rename = "comments")]
4708    Comments,
4709}
4710
4711#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4712#[non_exhaustive]
4713pub enum GroupFeatureEnabled {
4714    #[default]
4715    #[serde(rename = "on")]
4716    On,
4717    #[serde(rename = "off")]
4718    Off,
4719}
4720
4721#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4722#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4723#[cfg_attr(feature = "bon", builder(on(String, into)))]
4724pub struct GroupInfo {
4725    #[serde(
4726        rename = "groupId",
4727        deserialize_with = "deserialize_number_from_string"
4728    )]
4729    pub group_id: i64,
4730
4731    #[serde(rename = "useRelays", default)]
4732    pub use_relays: bool,
4733
4734    #[serde(rename = "relayOwnStatus", skip_serializing_if = "Option::is_none")]
4735    pub relay_own_status: Option<RelayStatus>,
4736
4737    #[serde(rename = "localDisplayName")]
4738    pub local_display_name: String,
4739
4740    #[serde(rename = "groupProfile")]
4741    pub group_profile: GroupProfile,
4742
4743    #[serde(rename = "localAlias")]
4744    pub local_alias: String,
4745
4746    #[serde(rename = "businessChat", skip_serializing_if = "Option::is_none")]
4747    pub business_chat: Option<BusinessChatInfo>,
4748
4749    #[serde(rename = "fullGroupPreferences")]
4750    pub full_group_preferences: FullGroupPreferences,
4751
4752    #[serde(rename = "membership")]
4753    pub membership: GroupMember,
4754
4755    #[serde(rename = "chatSettings")]
4756    pub chat_settings: ChatSettings,
4757
4758    #[serde(rename = "createdAt")]
4759    pub created_at: UtcTime,
4760
4761    #[serde(rename = "updatedAt")]
4762    pub updated_at: UtcTime,
4763
4764    #[serde(rename = "chatTs", skip_serializing_if = "Option::is_none")]
4765    pub chat_ts: Option<UtcTime>,
4766
4767    #[serde(
4768        rename = "userMemberProfileSentAt",
4769        skip_serializing_if = "Option::is_none"
4770    )]
4771    pub user_member_profile_sent_at: Option<UtcTime>,
4772
4773    #[serde(rename = "preparedGroup", skip_serializing_if = "Option::is_none")]
4774    pub prepared_group: Option<PreparedGroup>,
4775
4776    #[serde(rename = "chatTags")]
4777    pub chat_tags: Vec<i64>,
4778
4779    #[serde(
4780        rename = "chatItemTTL",
4781        skip_serializing_if = "Option::is_none",
4782        deserialize_with = "deserialize_option_number_from_string",
4783        default
4784    )]
4785    pub chat_item_ttl: Option<i64>,
4786
4787    #[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
4788    pub ui_themes: Option<UIThemeEntityOverrides>,
4789
4790    #[serde(rename = "customData", skip_serializing_if = "Option::is_none")]
4791    pub custom_data: Option<JsonObject>,
4792
4793    #[serde(rename = "groupSummary")]
4794    pub group_summary: GroupSummary,
4795
4796    #[serde(
4797        rename = "membersRequireAttention",
4798        deserialize_with = "deserialize_number_from_string"
4799    )]
4800    pub members_require_attention: i32,
4801
4802    #[serde(rename = "viaGroupLinkUri", skip_serializing_if = "Option::is_none")]
4803    pub via_group_link_uri: Option<String>,
4804
4805    #[serde(rename = "groupKeys", skip_serializing_if = "Option::is_none")]
4806    pub group_keys: Option<GroupKeys>,
4807
4808    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4809    #[cfg_attr(feature = "bon", builder(default))]
4810    pub undocumented: JsonObject,
4811}
4812
4813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4814#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4815#[cfg_attr(feature = "bon", builder(on(String, into)))]
4816pub struct GroupKeys {
4817    #[serde(rename = "publicGroupId")]
4818    pub public_group_id: String,
4819
4820    #[serde(rename = "groupRootKey")]
4821    pub group_root_key: GroupRootKey,
4822
4823    #[serde(rename = "memberPrivKey")]
4824    pub member_priv_key: String,
4825
4826    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4827    #[cfg_attr(feature = "bon", builder(default))]
4828    pub undocumented: JsonObject,
4829}
4830
4831#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4832#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4833#[cfg_attr(feature = "bon", builder(on(String, into)))]
4834pub struct GroupLink {
4835    #[serde(
4836        rename = "userContactLinkId",
4837        deserialize_with = "deserialize_number_from_string"
4838    )]
4839    pub user_contact_link_id: i64,
4840
4841    #[serde(rename = "connLinkContact")]
4842    pub conn_link_contact: CreatedConnLink,
4843
4844    #[serde(rename = "shortLinkDataSet", default)]
4845    pub short_link_data_set: bool,
4846
4847    #[serde(rename = "shortLinkLargeDataSet", default)]
4848    pub short_link_large_data_set: bool,
4849
4850    #[serde(rename = "groupLinkId")]
4851    pub group_link_id: String,
4852
4853    #[serde(rename = "acceptMemberRole")]
4854    pub accept_member_role: GroupMemberRole,
4855
4856    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4857    #[cfg_attr(feature = "bon", builder(default))]
4858    pub undocumented: JsonObject,
4859}
4860
4861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4862#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4863#[cfg_attr(feature = "bon", builder(on(String, into)))]
4864pub struct GroupLinkOwner {
4865    #[serde(rename = "memberId")]
4866    pub member_id: String,
4867
4868    #[serde(rename = "memberKey")]
4869    pub member_key: String,
4870
4871    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4872    #[cfg_attr(feature = "bon", builder(default))]
4873    pub undocumented: JsonObject,
4874}
4875
4876#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4877#[serde(tag = "type")]
4878#[non_exhaustive]
4879pub enum GroupLinkPlan {
4880    #[serde(rename = "ok")]
4881    Ok {
4882        #[serde(rename = "groupSLinkInfo_", skip_serializing_if = "Option::is_none")]
4883        group_s_link_info: Option<GroupShortLinkInfo>,
4884
4885        #[serde(rename = "groupSLinkData_", skip_serializing_if = "Option::is_none")]
4886        group_s_link_data: Option<GroupShortLinkData>,
4887
4888        #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
4889        owner_verification: Option<OwnerVerification>,
4890
4891        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4892        undocumented: JsonObject,
4893    },
4894    #[serde(rename = "ownLink")]
4895    OwnLink {
4896        #[serde(rename = "groupInfo")]
4897        group_info: GroupInfo,
4898
4899        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4900        undocumented: JsonObject,
4901    },
4902    #[serde(rename = "connectingConfirmReconnect")]
4903    ConnectingConfirmReconnect,
4904    #[serde(rename = "connectingProhibit")]
4905    ConnectingProhibit {
4906        #[serde(rename = "groupInfo_", skip_serializing_if = "Option::is_none")]
4907        group_info: Option<GroupInfo>,
4908
4909        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4910        undocumented: JsonObject,
4911    },
4912    #[serde(rename = "known")]
4913    Known {
4914        #[serde(rename = "groupInfo")]
4915        group_info: GroupInfo,
4916
4917        #[serde(rename = "groupUpdated", default)]
4918        group_updated: bool,
4919
4920        #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
4921        owner_verification: Option<OwnerVerification>,
4922
4923        #[serde(rename = "linkOwners")]
4924        link_owners: Vec<GroupLinkOwner>,
4925
4926        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4927        undocumented: JsonObject,
4928    },
4929    #[serde(rename = "noRelays")]
4930    NoRelays {
4931        #[serde(rename = "groupSLinkData_", skip_serializing_if = "Option::is_none")]
4932        group_s_link_data: Option<GroupShortLinkData>,
4933
4934        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4935        undocumented: JsonObject,
4936    },
4937    #[serde(rename = "updateRequired")]
4938    UpdateRequired {
4939        #[serde(rename = "groupSLinkData_", skip_serializing_if = "Option::is_none")]
4940        group_s_link_data: Option<GroupShortLinkData>,
4941
4942        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4943        undocumented: JsonObject,
4944    },
4945    #[serde(untagged)]
4946    Undocumented(JsonObject),
4947}
4948
4949impl GroupLinkPlan {
4950    pub fn make_ok(
4951        group_s_link_info: Option<GroupShortLinkInfo>,
4952        group_s_link_data: Option<GroupShortLinkData>,
4953        owner_verification: Option<OwnerVerification>,
4954    ) -> Self {
4955        Self::Ok {
4956            group_s_link_info,
4957            group_s_link_data,
4958            owner_verification,
4959            undocumented: Default::default(),
4960        }
4961    }
4962
4963    pub fn make_own_link(group_info: GroupInfo) -> Self {
4964        Self::OwnLink {
4965            group_info,
4966            undocumented: Default::default(),
4967        }
4968    }
4969
4970    pub fn make_connecting_confirm_reconnect() -> Self {
4971        Self::ConnectingConfirmReconnect
4972    }
4973
4974    pub fn make_connecting_prohibit(group_info: Option<GroupInfo>) -> Self {
4975        Self::ConnectingProhibit {
4976            group_info,
4977            undocumented: Default::default(),
4978        }
4979    }
4980
4981    pub fn make_known(
4982        group_info: GroupInfo,
4983        group_updated: bool,
4984        owner_verification: Option<OwnerVerification>,
4985        link_owners: Vec<GroupLinkOwner>,
4986    ) -> Self {
4987        Self::Known {
4988            group_info,
4989            group_updated,
4990            owner_verification,
4991            link_owners,
4992            undocumented: Default::default(),
4993        }
4994    }
4995
4996    pub fn make_no_relays(group_s_link_data: Option<GroupShortLinkData>) -> Self {
4997        Self::NoRelays {
4998            group_s_link_data,
4999            undocumented: Default::default(),
5000        }
5001    }
5002
5003    pub fn make_update_required(group_s_link_data: Option<GroupShortLinkData>) -> Self {
5004        Self::UpdateRequired {
5005            group_s_link_data,
5006            undocumented: Default::default(),
5007        }
5008    }
5009}
5010
5011impl GroupLinkPlan {
5012    pub fn ok(&self) -> Option<GroupLinkPlanOkRef<'_>> {
5013        if let Self::Ok {
5014            group_s_link_info,
5015            group_s_link_data,
5016            owner_verification,
5017            ..
5018        } = self
5019        {
5020            Some(GroupLinkPlanOkRef {
5021                group_s_link_info,
5022                group_s_link_data,
5023                owner_verification,
5024            })
5025        } else {
5026            None
5027        }
5028    }
5029    pub fn own_link(&self) -> Option<&GroupInfo> {
5030        if let Self::OwnLink { group_info, .. } = self {
5031            Some(group_info)
5032        } else {
5033            None
5034        }
5035    }
5036    pub fn is_connecting_confirm_reconnect(&self) -> bool {
5037        matches!(self, Self::ConnectingConfirmReconnect)
5038    }
5039    pub fn connecting_prohibit(&self) -> Option<&Option<GroupInfo>> {
5040        if let Self::ConnectingProhibit { group_info, .. } = self {
5041            Some(group_info)
5042        } else {
5043            None
5044        }
5045    }
5046    pub fn known(&self) -> Option<GroupLinkPlanKnownRef<'_>> {
5047        if let Self::Known {
5048            group_info,
5049            group_updated,
5050            owner_verification,
5051            link_owners,
5052            ..
5053        } = self
5054        {
5055            Some(GroupLinkPlanKnownRef {
5056                group_info,
5057                group_updated,
5058                owner_verification,
5059                link_owners,
5060            })
5061        } else {
5062            None
5063        }
5064    }
5065    pub fn no_relays(&self) -> Option<&Option<GroupShortLinkData>> {
5066        if let Self::NoRelays {
5067            group_s_link_data, ..
5068        } = self
5069        {
5070            Some(group_s_link_data)
5071        } else {
5072            None
5073        }
5074    }
5075    pub fn update_required(&self) -> Option<&Option<GroupShortLinkData>> {
5076        if let Self::UpdateRequired {
5077            group_s_link_data, ..
5078        } = self
5079        {
5080            Some(group_s_link_data)
5081        } else {
5082            None
5083        }
5084    }
5085}
5086#[derive(Clone, Copy)]
5087pub struct GroupLinkPlanOkRef<'a> {
5088    pub group_s_link_info: &'a Option<GroupShortLinkInfo>,
5089    pub group_s_link_data: &'a Option<GroupShortLinkData>,
5090    pub owner_verification: &'a Option<OwnerVerification>,
5091}
5092#[derive(Clone, Copy)]
5093pub struct GroupLinkPlanKnownRef<'a> {
5094    pub group_info: &'a GroupInfo,
5095    pub group_updated: &'a bool,
5096    pub owner_verification: &'a Option<OwnerVerification>,
5097    pub link_owners: &'a Vec<GroupLinkOwner>,
5098}
5099
5100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5101#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5102#[cfg_attr(feature = "bon", builder(on(String, into)))]
5103pub struct GroupMember {
5104    #[serde(
5105        rename = "groupMemberId",
5106        deserialize_with = "deserialize_number_from_string"
5107    )]
5108    pub group_member_id: i64,
5109
5110    #[serde(
5111        rename = "groupId",
5112        deserialize_with = "deserialize_number_from_string"
5113    )]
5114    pub group_id: i64,
5115
5116    #[serde(
5117        rename = "indexInGroup",
5118        deserialize_with = "deserialize_number_from_string"
5119    )]
5120    pub index_in_group: i64,
5121
5122    #[serde(rename = "memberId")]
5123    pub member_id: String,
5124
5125    #[serde(rename = "memberRole")]
5126    pub member_role: GroupMemberRole,
5127
5128    #[serde(rename = "memberCategory")]
5129    pub member_category: GroupMemberCategory,
5130
5131    #[serde(rename = "memberStatus")]
5132    pub member_status: GroupMemberStatus,
5133
5134    #[serde(rename = "memberSettings")]
5135    pub member_settings: GroupMemberSettings,
5136
5137    #[serde(rename = "blockedByAdmin", default)]
5138    pub blocked_by_admin: bool,
5139
5140    #[serde(rename = "invitedBy")]
5141    pub invited_by: InvitedBy,
5142
5143    #[serde(
5144        rename = "invitedByGroupMemberId",
5145        skip_serializing_if = "Option::is_none",
5146        deserialize_with = "deserialize_option_number_from_string",
5147        default
5148    )]
5149    pub invited_by_group_member_id: Option<i64>,
5150
5151    #[serde(rename = "localDisplayName")]
5152    pub local_display_name: String,
5153
5154    #[serde(rename = "memberProfile")]
5155    pub member_profile: LocalProfile,
5156
5157    #[serde(
5158        rename = "memberContactId",
5159        skip_serializing_if = "Option::is_none",
5160        deserialize_with = "deserialize_option_number_from_string",
5161        default
5162    )]
5163    pub member_contact_id: Option<i64>,
5164
5165    #[serde(
5166        rename = "memberContactProfileId",
5167        deserialize_with = "deserialize_number_from_string"
5168    )]
5169    pub member_contact_profile_id: i64,
5170
5171    #[serde(rename = "activeConn", skip_serializing_if = "Option::is_none")]
5172    pub active_conn: Option<Connection>,
5173
5174    #[serde(rename = "memberChatVRange")]
5175    pub member_chat_v_range: VersionRange,
5176
5177    #[serde(rename = "createdAt")]
5178    pub created_at: UtcTime,
5179
5180    #[serde(rename = "updatedAt")]
5181    pub updated_at: UtcTime,
5182
5183    #[serde(rename = "supportChat", skip_serializing_if = "Option::is_none")]
5184    pub support_chat: Option<GroupSupportChat>,
5185
5186    #[serde(rename = "memberPubKey", skip_serializing_if = "Option::is_none")]
5187    pub member_pub_key: Option<String>,
5188
5189    #[serde(rename = "relayLink", skip_serializing_if = "Option::is_none")]
5190    pub relay_link: Option<String>,
5191
5192    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5193    #[cfg_attr(feature = "bon", builder(default))]
5194    pub undocumented: JsonObject,
5195}
5196
5197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5198#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5199#[cfg_attr(feature = "bon", builder(on(String, into)))]
5200pub struct GroupMemberAdmission {
5201    #[serde(rename = "review", skip_serializing_if = "Option::is_none")]
5202    pub review: Option<MemberCriteria>,
5203
5204    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5205    #[cfg_attr(feature = "bon", builder(default))]
5206    pub undocumented: JsonObject,
5207}
5208
5209#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5210#[non_exhaustive]
5211pub enum GroupMemberCategory {
5212    #[default]
5213    #[serde(rename = "user")]
5214    User,
5215    #[serde(rename = "invitee")]
5216    Invitee,
5217    #[serde(rename = "host")]
5218    Host,
5219    #[serde(rename = "pre")]
5220    Pre,
5221    #[serde(rename = "post")]
5222    Post,
5223}
5224
5225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5226#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5227#[cfg_attr(feature = "bon", builder(on(String, into)))]
5228pub struct GroupMemberRef {
5229    #[serde(
5230        rename = "groupMemberId",
5231        deserialize_with = "deserialize_number_from_string"
5232    )]
5233    pub group_member_id: i64,
5234
5235    #[serde(rename = "profile")]
5236    pub profile: Profile,
5237
5238    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5239    #[cfg_attr(feature = "bon", builder(default))]
5240    pub undocumented: JsonObject,
5241}
5242
5243#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5244#[non_exhaustive]
5245pub enum GroupMemberRole {
5246    #[default]
5247    #[serde(rename = "relay")]
5248    Relay,
5249    #[serde(rename = "observer")]
5250    Observer,
5251    #[serde(rename = "author")]
5252    Author,
5253    #[serde(rename = "member")]
5254    Member,
5255    #[serde(rename = "moderator")]
5256    Moderator,
5257    #[serde(rename = "admin")]
5258    Admin,
5259    #[serde(rename = "owner")]
5260    Owner,
5261}
5262
5263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5264#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5265#[cfg_attr(feature = "bon", builder(on(String, into)))]
5266pub struct GroupMemberSettings {
5267    #[serde(rename = "showMessages", default)]
5268    pub show_messages: bool,
5269
5270    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5271    #[cfg_attr(feature = "bon", builder(default))]
5272    pub undocumented: JsonObject,
5273}
5274
5275#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5276#[non_exhaustive]
5277pub enum GroupMemberStatus {
5278    #[default]
5279    #[serde(rename = "rejected")]
5280    Rejected,
5281    #[serde(rename = "removed")]
5282    Removed,
5283    #[serde(rename = "left")]
5284    Left,
5285    #[serde(rename = "deleted")]
5286    Deleted,
5287    #[serde(rename = "unknown")]
5288    Unknown,
5289    #[serde(rename = "invited")]
5290    Invited,
5291    #[serde(rename = "pending_approval")]
5292    PendingApproval,
5293    #[serde(rename = "pending_review")]
5294    PendingReview,
5295    #[serde(rename = "introduced")]
5296    Introduced,
5297    #[serde(rename = "intro-inv")]
5298    IntroInv,
5299    #[serde(rename = "accepted")]
5300    Accepted,
5301    #[serde(rename = "announced")]
5302    Announced,
5303    #[serde(rename = "connected")]
5304    Connected,
5305    #[serde(rename = "complete")]
5306    Complete,
5307    #[serde(rename = "creator")]
5308    Creator,
5309}
5310
5311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5312#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5313#[cfg_attr(feature = "bon", builder(on(String, into)))]
5314pub struct GroupPreference {
5315    #[serde(rename = "enable")]
5316    pub enable: GroupFeatureEnabled,
5317
5318    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5319    #[cfg_attr(feature = "bon", builder(default))]
5320    pub undocumented: JsonObject,
5321}
5322
5323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5324#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5325#[cfg_attr(feature = "bon", builder(on(String, into)))]
5326pub struct GroupPreferences {
5327    #[serde(rename = "timedMessages", skip_serializing_if = "Option::is_none")]
5328    pub timed_messages: Option<TimedMessagesGroupPreference>,
5329
5330    #[serde(rename = "directMessages", skip_serializing_if = "Option::is_none")]
5331    pub direct_messages: Option<RoleGroupPreference>,
5332
5333    #[serde(rename = "fullDelete", skip_serializing_if = "Option::is_none")]
5334    pub full_delete: Option<GroupPreference>,
5335
5336    #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
5337    pub reactions: Option<GroupPreference>,
5338
5339    #[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
5340    pub voice: Option<RoleGroupPreference>,
5341
5342    #[serde(rename = "files", skip_serializing_if = "Option::is_none")]
5343    pub files: Option<RoleGroupPreference>,
5344
5345    #[serde(rename = "simplexLinks", skip_serializing_if = "Option::is_none")]
5346    pub simplex_links: Option<RoleGroupPreference>,
5347
5348    #[serde(rename = "reports", skip_serializing_if = "Option::is_none")]
5349    pub reports: Option<GroupPreference>,
5350
5351    #[serde(rename = "history", skip_serializing_if = "Option::is_none")]
5352    pub history: Option<GroupPreference>,
5353
5354    #[serde(rename = "support", skip_serializing_if = "Option::is_none")]
5355    pub support: Option<SupportGroupPreference>,
5356
5357    #[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
5358    pub sessions: Option<RoleGroupPreference>,
5359
5360    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
5361    pub comments: Option<CommentsGroupPreference>,
5362
5363    #[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
5364    pub commands: Option<Vec<ChatBotCommand>>,
5365
5366    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5367    #[cfg_attr(feature = "bon", builder(default))]
5368    pub undocumented: JsonObject,
5369}
5370
5371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5372#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5373#[cfg_attr(feature = "bon", builder(on(String, into)))]
5374pub struct GroupProfile {
5375    #[serde(rename = "displayName")]
5376    pub display_name: String,
5377
5378    #[serde(rename = "fullName")]
5379    pub full_name: String,
5380
5381    #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
5382    pub short_descr: Option<String>,
5383
5384    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
5385    pub description: Option<String>,
5386
5387    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
5388    pub image: Option<String>,
5389
5390    #[serde(rename = "publicGroup", skip_serializing_if = "Option::is_none")]
5391    pub public_group: Option<PublicGroupProfile>,
5392
5393    #[serde(rename = "groupPreferences", skip_serializing_if = "Option::is_none")]
5394    pub group_preferences: Option<GroupPreferences>,
5395
5396    #[serde(rename = "memberAdmission", skip_serializing_if = "Option::is_none")]
5397    pub member_admission: Option<GroupMemberAdmission>,
5398
5399    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5400    #[cfg_attr(feature = "bon", builder(default))]
5401    pub undocumented: JsonObject,
5402}
5403
5404#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5405#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5406#[cfg_attr(feature = "bon", builder(on(String, into)))]
5407pub struct GroupRelay {
5408    #[serde(
5409        rename = "groupRelayId",
5410        deserialize_with = "deserialize_number_from_string"
5411    )]
5412    pub group_relay_id: i64,
5413
5414    #[serde(
5415        rename = "groupMemberId",
5416        deserialize_with = "deserialize_number_from_string"
5417    )]
5418    pub group_member_id: i64,
5419
5420    #[serde(rename = "userChatRelay")]
5421    pub user_chat_relay: UserChatRelay,
5422
5423    #[serde(rename = "relayStatus")]
5424    pub relay_status: RelayStatus,
5425
5426    #[serde(rename = "relayLink", skip_serializing_if = "Option::is_none")]
5427    pub relay_link: Option<String>,
5428
5429    #[serde(rename = "relayCap")]
5430    pub relay_cap: RelayCapabilities,
5431
5432    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5433    #[cfg_attr(feature = "bon", builder(default))]
5434    pub undocumented: JsonObject,
5435}
5436
5437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5438#[serde(tag = "type")]
5439#[non_exhaustive]
5440pub enum GroupRootKey {
5441    #[serde(rename = "private")]
5442    Private {
5443        #[serde(rename = "rootPrivKey")]
5444        root_priv_key: String,
5445
5446        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5447        undocumented: JsonObject,
5448    },
5449    #[serde(rename = "public")]
5450    Public {
5451        #[serde(rename = "rootPubKey")]
5452        root_pub_key: String,
5453
5454        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5455        undocumented: JsonObject,
5456    },
5457    #[serde(untagged)]
5458    Undocumented(JsonObject),
5459}
5460
5461impl GroupRootKey {
5462    pub fn make_private(root_priv_key: String) -> Self {
5463        Self::Private {
5464            root_priv_key,
5465            undocumented: Default::default(),
5466        }
5467    }
5468
5469    pub fn make_public(root_pub_key: String) -> Self {
5470        Self::Public {
5471            root_pub_key,
5472            undocumented: Default::default(),
5473        }
5474    }
5475}
5476
5477impl GroupRootKey {
5478    pub fn private(&self) -> Option<&String> {
5479        if let Self::Private { root_priv_key, .. } = self {
5480            Some(root_priv_key)
5481        } else {
5482            None
5483        }
5484    }
5485    pub fn public(&self) -> Option<&String> {
5486        if let Self::Public { root_pub_key, .. } = self {
5487            Some(root_pub_key)
5488        } else {
5489            None
5490        }
5491    }
5492}
5493
5494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5495#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5496#[cfg_attr(feature = "bon", builder(on(String, into)))]
5497pub struct GroupShortLinkData {
5498    #[serde(rename = "groupProfile")]
5499    pub group_profile: GroupProfile,
5500
5501    #[serde(rename = "publicGroupData", skip_serializing_if = "Option::is_none")]
5502    pub public_group_data: Option<PublicGroupData>,
5503
5504    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5505    #[cfg_attr(feature = "bon", builder(default))]
5506    pub undocumented: JsonObject,
5507}
5508
5509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5510#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5511#[cfg_attr(feature = "bon", builder(on(String, into)))]
5512pub struct GroupShortLinkInfo {
5513    #[serde(rename = "direct", default)]
5514    pub direct: bool,
5515
5516    #[serde(rename = "groupRelays")]
5517    pub group_relays: Vec<String>,
5518
5519    #[serde(rename = "publicGroupId", skip_serializing_if = "Option::is_none")]
5520    pub public_group_id: Option<String>,
5521
5522    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5523    #[cfg_attr(feature = "bon", builder(default))]
5524    pub undocumented: JsonObject,
5525}
5526
5527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5528#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5529#[cfg_attr(feature = "bon", builder(on(String, into)))]
5530pub struct GroupSummary {
5531    #[serde(
5532        rename = "currentMembers",
5533        deserialize_with = "deserialize_number_from_string"
5534    )]
5535    pub current_members: i64,
5536
5537    #[serde(
5538        rename = "publicMemberCount",
5539        skip_serializing_if = "Option::is_none",
5540        deserialize_with = "deserialize_option_number_from_string",
5541        default
5542    )]
5543    pub public_member_count: Option<i64>,
5544
5545    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5546    #[cfg_attr(feature = "bon", builder(default))]
5547    pub undocumented: JsonObject,
5548}
5549
5550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5551#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5552#[cfg_attr(feature = "bon", builder(on(String, into)))]
5553pub struct GroupSupportChat {
5554    #[serde(rename = "chatTs")]
5555    pub chat_ts: UtcTime,
5556
5557    #[serde(rename = "unread", deserialize_with = "deserialize_number_from_string")]
5558    pub unread: i64,
5559
5560    #[serde(
5561        rename = "memberAttention",
5562        deserialize_with = "deserialize_number_from_string"
5563    )]
5564    pub member_attention: i64,
5565
5566    #[serde(
5567        rename = "mentions",
5568        deserialize_with = "deserialize_number_from_string"
5569    )]
5570    pub mentions: i64,
5571
5572    #[serde(
5573        rename = "lastMsgFromMemberTs",
5574        skip_serializing_if = "Option::is_none"
5575    )]
5576    pub last_msg_from_member_ts: Option<UtcTime>,
5577
5578    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5579    #[cfg_attr(feature = "bon", builder(default))]
5580    pub undocumented: JsonObject,
5581}
5582
5583#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5584#[non_exhaustive]
5585pub enum GroupType {
5586    #[default]
5587    #[serde(rename = "channel")]
5588    Channel,
5589    #[serde(rename = "group")]
5590    Group,
5591}
5592
5593#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5594#[non_exhaustive]
5595pub enum InlineFileMode {
5596    #[default]
5597    #[serde(rename = "offer")]
5598    Offer,
5599    #[serde(rename = "sent")]
5600    Sent,
5601}
5602
5603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5604#[serde(tag = "type")]
5605#[non_exhaustive]
5606pub enum InvitationLinkPlan {
5607    #[serde(rename = "ok")]
5608    Ok {
5609        #[serde(rename = "contactSLinkData_", skip_serializing_if = "Option::is_none")]
5610        contact_s_link_data: Option<ContactShortLinkData>,
5611
5612        #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
5613        owner_verification: Option<OwnerVerification>,
5614
5615        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5616        undocumented: JsonObject,
5617    },
5618    #[serde(rename = "ownLink")]
5619    OwnLink,
5620    #[serde(rename = "connecting")]
5621    Connecting {
5622        #[serde(rename = "contact_", skip_serializing_if = "Option::is_none")]
5623        contact: Option<Contact>,
5624
5625        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5626        undocumented: JsonObject,
5627    },
5628    #[serde(rename = "known")]
5629    Known {
5630        #[serde(rename = "contact")]
5631        contact: Contact,
5632
5633        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5634        undocumented: JsonObject,
5635    },
5636    #[serde(untagged)]
5637    Undocumented(JsonObject),
5638}
5639
5640impl InvitationLinkPlan {
5641    pub fn make_ok(
5642        contact_s_link_data: Option<ContactShortLinkData>,
5643        owner_verification: Option<OwnerVerification>,
5644    ) -> Self {
5645        Self::Ok {
5646            contact_s_link_data,
5647            owner_verification,
5648            undocumented: Default::default(),
5649        }
5650    }
5651
5652    pub fn make_own_link() -> Self {
5653        Self::OwnLink
5654    }
5655
5656    pub fn make_connecting(contact: Option<Contact>) -> Self {
5657        Self::Connecting {
5658            contact,
5659            undocumented: Default::default(),
5660        }
5661    }
5662
5663    pub fn make_known(contact: Contact) -> Self {
5664        Self::Known {
5665            contact,
5666            undocumented: Default::default(),
5667        }
5668    }
5669}
5670
5671impl InvitationLinkPlan {
5672    pub fn ok(&self) -> Option<InvitationLinkPlanOkRef<'_>> {
5673        if let Self::Ok {
5674            contact_s_link_data,
5675            owner_verification,
5676            ..
5677        } = self
5678        {
5679            Some(InvitationLinkPlanOkRef {
5680                contact_s_link_data,
5681                owner_verification,
5682            })
5683        } else {
5684            None
5685        }
5686    }
5687    pub fn is_own_link(&self) -> bool {
5688        matches!(self, Self::OwnLink)
5689    }
5690    pub fn connecting(&self) -> Option<&Option<Contact>> {
5691        if let Self::Connecting { contact, .. } = self {
5692            Some(contact)
5693        } else {
5694            None
5695        }
5696    }
5697    pub fn known(&self) -> Option<&Contact> {
5698        if let Self::Known { contact, .. } = self {
5699            Some(contact)
5700        } else {
5701            None
5702        }
5703    }
5704}
5705#[derive(Clone, Copy)]
5706pub struct InvitationLinkPlanOkRef<'a> {
5707    pub contact_s_link_data: &'a Option<ContactShortLinkData>,
5708    pub owner_verification: &'a Option<OwnerVerification>,
5709}
5710
5711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5712#[serde(tag = "type")]
5713#[non_exhaustive]
5714pub enum InvitedBy {
5715    #[serde(rename = "contact")]
5716    Contact {
5717        #[serde(
5718            rename = "byContactId",
5719            deserialize_with = "deserialize_number_from_string"
5720        )]
5721        by_contact_id: i64,
5722
5723        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5724        undocumented: JsonObject,
5725    },
5726    #[serde(rename = "user")]
5727    User,
5728    #[serde(rename = "unknown")]
5729    Unknown,
5730    #[serde(untagged)]
5731    Undocumented(JsonObject),
5732}
5733
5734impl InvitedBy {
5735    pub fn make_contact(by_contact_id: i64) -> Self {
5736        Self::Contact {
5737            by_contact_id,
5738            undocumented: Default::default(),
5739        }
5740    }
5741
5742    pub fn make_user() -> Self {
5743        Self::User
5744    }
5745
5746    pub fn make_unknown() -> Self {
5747        Self::Unknown
5748    }
5749}
5750
5751impl InvitedBy {
5752    pub fn contact(&self) -> Option<&i64> {
5753        if let Self::Contact { by_contact_id, .. } = self {
5754            Some(by_contact_id)
5755        } else {
5756            None
5757        }
5758    }
5759    pub fn is_user(&self) -> bool {
5760        matches!(self, Self::User)
5761    }
5762    pub fn is_unknown(&self) -> bool {
5763        matches!(self, Self::Unknown)
5764    }
5765}
5766
5767#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5768#[serde(tag = "type")]
5769#[non_exhaustive]
5770pub enum LinkContent {
5771    #[serde(rename = "page")]
5772    Page,
5773    #[serde(rename = "image")]
5774    Image,
5775    #[serde(rename = "video")]
5776    Video {
5777        #[serde(
5778            rename = "duration",
5779            skip_serializing_if = "Option::is_none",
5780            deserialize_with = "deserialize_option_number_from_string",
5781            default
5782        )]
5783        duration: Option<i32>,
5784
5785        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5786        undocumented: JsonObject,
5787    },
5788    #[serde(rename = "unknown")]
5789    Unknown {
5790        #[serde(rename = "tag")]
5791        tag: String,
5792
5793        #[serde(rename = "json")]
5794        json: JsonObject,
5795
5796        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5797        undocumented: JsonObject,
5798    },
5799    #[serde(untagged)]
5800    Undocumented(JsonObject),
5801}
5802
5803impl LinkContent {
5804    pub fn make_page() -> Self {
5805        Self::Page
5806    }
5807
5808    pub fn make_image() -> Self {
5809        Self::Image
5810    }
5811
5812    pub fn make_video(duration: Option<i32>) -> Self {
5813        Self::Video {
5814            duration,
5815            undocumented: Default::default(),
5816        }
5817    }
5818
5819    pub fn make_unknown(tag: String, json: JsonObject) -> Self {
5820        Self::Unknown {
5821            tag,
5822            json,
5823            undocumented: Default::default(),
5824        }
5825    }
5826}
5827
5828impl LinkContent {
5829    pub fn is_page(&self) -> bool {
5830        matches!(self, Self::Page)
5831    }
5832    pub fn is_image(&self) -> bool {
5833        matches!(self, Self::Image)
5834    }
5835    pub fn video(&self) -> Option<&Option<i32>> {
5836        if let Self::Video { duration, .. } = self {
5837            Some(duration)
5838        } else {
5839            None
5840        }
5841    }
5842    pub fn unknown(&self) -> Option<LinkContentUnknownRef<'_>> {
5843        if let Self::Unknown { tag, json, .. } = self {
5844            Some(LinkContentUnknownRef { tag, json })
5845        } else {
5846            None
5847        }
5848    }
5849}
5850#[derive(Clone, Copy)]
5851pub struct LinkContentUnknownRef<'a> {
5852    pub tag: &'a String,
5853    pub json: &'a JsonObject,
5854}
5855
5856#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5857#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5858#[cfg_attr(feature = "bon", builder(on(String, into)))]
5859pub struct LinkOwnerSig {
5860    #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")]
5861    pub owner_id: Option<String>,
5862
5863    #[serde(rename = "chatBinding")]
5864    pub chat_binding: String,
5865
5866    #[serde(rename = "ownerSig")]
5867    pub owner_sig: String,
5868
5869    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5870    #[cfg_attr(feature = "bon", builder(default))]
5871    pub undocumented: JsonObject,
5872}
5873
5874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5875#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5876#[cfg_attr(feature = "bon", builder(on(String, into)))]
5877pub struct LinkPreview {
5878    #[serde(rename = "uri")]
5879    pub uri: String,
5880
5881    #[serde(rename = "title")]
5882    pub title: String,
5883
5884    #[serde(rename = "description")]
5885    pub description: String,
5886
5887    #[serde(rename = "image")]
5888    pub image: String,
5889
5890    #[serde(rename = "content", skip_serializing_if = "Option::is_none")]
5891    pub content: Option<LinkContent>,
5892
5893    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5894    #[cfg_attr(feature = "bon", builder(default))]
5895    pub undocumented: JsonObject,
5896}
5897
5898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5899#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5900#[cfg_attr(feature = "bon", builder(on(String, into)))]
5901pub struct LocalProfile {
5902    #[serde(
5903        rename = "profileId",
5904        deserialize_with = "deserialize_number_from_string"
5905    )]
5906    pub profile_id: i64,
5907
5908    #[serde(rename = "displayName")]
5909    pub display_name: String,
5910
5911    #[serde(rename = "fullName")]
5912    pub full_name: String,
5913
5914    #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
5915    pub short_descr: Option<String>,
5916
5917    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
5918    pub image: Option<String>,
5919
5920    #[serde(rename = "contactLink", skip_serializing_if = "Option::is_none")]
5921    pub contact_link: Option<String>,
5922
5923    #[serde(rename = "preferences", skip_serializing_if = "Option::is_none")]
5924    pub preferences: Option<Preferences>,
5925
5926    #[serde(rename = "peerType", skip_serializing_if = "Option::is_none")]
5927    pub peer_type: Option<ChatPeerType>,
5928
5929    #[serde(rename = "localAlias")]
5930    pub local_alias: String,
5931
5932    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5933    #[cfg_attr(feature = "bon", builder(default))]
5934    pub undocumented: JsonObject,
5935}
5936
5937#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5938#[non_exhaustive]
5939pub enum MemberCriteria {
5940    #[default]
5941    #[serde(rename = "all")]
5942    All,
5943}
5944
5945/// Connection link sent in a message - only short links are allowed.
5946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5947#[serde(tag = "type")]
5948#[non_exhaustive]
5949pub enum MsgChatLink {
5950    #[serde(rename = "contact")]
5951    Contact {
5952        #[serde(rename = "connLink")]
5953        conn_link: String,
5954
5955        #[serde(rename = "profile")]
5956        profile: Profile,
5957
5958        #[serde(rename = "business", default)]
5959        business: bool,
5960
5961        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5962        undocumented: JsonObject,
5963    },
5964    #[serde(rename = "invitation")]
5965    Invitation {
5966        #[serde(rename = "invLink")]
5967        inv_link: String,
5968
5969        #[serde(rename = "profile")]
5970        profile: Profile,
5971
5972        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5973        undocumented: JsonObject,
5974    },
5975    #[serde(rename = "group")]
5976    Group {
5977        #[serde(rename = "connLink")]
5978        conn_link: String,
5979
5980        #[serde(rename = "groupProfile")]
5981        group_profile: GroupProfile,
5982
5983        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5984        undocumented: JsonObject,
5985    },
5986    #[serde(untagged)]
5987    Undocumented(JsonObject),
5988}
5989
5990impl MsgChatLink {
5991    pub fn make_contact(conn_link: String, profile: Profile, business: bool) -> Self {
5992        Self::Contact {
5993            conn_link,
5994            profile,
5995            business,
5996            undocumented: Default::default(),
5997        }
5998    }
5999
6000    pub fn make_invitation(inv_link: String, profile: Profile) -> Self {
6001        Self::Invitation {
6002            inv_link,
6003            profile,
6004            undocumented: Default::default(),
6005        }
6006    }
6007
6008    pub fn make_group(conn_link: String, group_profile: GroupProfile) -> Self {
6009        Self::Group {
6010            conn_link,
6011            group_profile,
6012            undocumented: Default::default(),
6013        }
6014    }
6015}
6016
6017impl MsgChatLink {
6018    pub fn contact(&self) -> Option<MsgChatLinkContactRef<'_>> {
6019        if let Self::Contact {
6020            conn_link,
6021            profile,
6022            business,
6023            ..
6024        } = self
6025        {
6026            Some(MsgChatLinkContactRef {
6027                conn_link,
6028                profile,
6029                business,
6030            })
6031        } else {
6032            None
6033        }
6034    }
6035    pub fn invitation(&self) -> Option<MsgChatLinkInvitationRef<'_>> {
6036        if let Self::Invitation {
6037            inv_link, profile, ..
6038        } = self
6039        {
6040            Some(MsgChatLinkInvitationRef { inv_link, profile })
6041        } else {
6042            None
6043        }
6044    }
6045    pub fn group(&self) -> Option<MsgChatLinkGroupRef<'_>> {
6046        if let Self::Group {
6047            conn_link,
6048            group_profile,
6049            ..
6050        } = self
6051        {
6052            Some(MsgChatLinkGroupRef {
6053                conn_link,
6054                group_profile,
6055            })
6056        } else {
6057            None
6058        }
6059    }
6060}
6061#[derive(Clone, Copy)]
6062pub struct MsgChatLinkContactRef<'a> {
6063    pub conn_link: &'a String,
6064    pub profile: &'a Profile,
6065    pub business: &'a bool,
6066}
6067#[derive(Clone, Copy)]
6068pub struct MsgChatLinkInvitationRef<'a> {
6069    pub inv_link: &'a String,
6070    pub profile: &'a Profile,
6071}
6072#[derive(Clone, Copy)]
6073pub struct MsgChatLinkGroupRef<'a> {
6074    pub conn_link: &'a String,
6075    pub group_profile: &'a GroupProfile,
6076}
6077
6078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6079#[serde(tag = "type")]
6080#[non_exhaustive]
6081pub enum MsgContent {
6082    #[serde(rename = "text")]
6083    Text {
6084        #[serde(rename = "text")]
6085        text: String,
6086
6087        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6088        undocumented: JsonObject,
6089    },
6090    #[serde(rename = "link")]
6091    Link {
6092        #[serde(rename = "text")]
6093        text: String,
6094
6095        #[serde(rename = "preview")]
6096        preview: LinkPreview,
6097
6098        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6099        undocumented: JsonObject,
6100    },
6101    #[serde(rename = "image")]
6102    Image {
6103        #[serde(rename = "text")]
6104        text: String,
6105
6106        #[serde(rename = "image")]
6107        image: String,
6108
6109        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6110        undocumented: JsonObject,
6111    },
6112    #[serde(rename = "video")]
6113    Video {
6114        #[serde(rename = "text")]
6115        text: String,
6116
6117        #[serde(rename = "image")]
6118        image: String,
6119
6120        #[serde(
6121            rename = "duration",
6122            deserialize_with = "deserialize_number_from_string"
6123        )]
6124        duration: i32,
6125
6126        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6127        undocumented: JsonObject,
6128    },
6129    #[serde(rename = "voice")]
6130    Voice {
6131        #[serde(rename = "text")]
6132        text: String,
6133
6134        #[serde(
6135            rename = "duration",
6136            deserialize_with = "deserialize_number_from_string"
6137        )]
6138        duration: i32,
6139
6140        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6141        undocumented: JsonObject,
6142    },
6143    #[serde(rename = "file")]
6144    File {
6145        #[serde(rename = "text")]
6146        text: String,
6147
6148        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6149        undocumented: JsonObject,
6150    },
6151    #[serde(rename = "report")]
6152    Report {
6153        #[serde(rename = "text")]
6154        text: String,
6155
6156        #[serde(rename = "reason")]
6157        reason: ReportReason,
6158
6159        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6160        undocumented: JsonObject,
6161    },
6162    #[serde(rename = "chat")]
6163    Chat {
6164        #[serde(rename = "text")]
6165        text: String,
6166
6167        #[serde(rename = "chatLink")]
6168        chat_link: MsgChatLink,
6169
6170        #[serde(rename = "ownerSig", skip_serializing_if = "Option::is_none")]
6171        owner_sig: Option<LinkOwnerSig>,
6172
6173        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6174        undocumented: JsonObject,
6175    },
6176    #[serde(rename = "unknown")]
6177    Unknown {
6178        #[serde(rename = "tag")]
6179        tag: String,
6180
6181        #[serde(rename = "text")]
6182        text: String,
6183
6184        #[serde(rename = "json")]
6185        json: JsonObject,
6186
6187        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6188        undocumented: JsonObject,
6189    },
6190    #[serde(untagged)]
6191    Undocumented(JsonObject),
6192}
6193
6194impl MsgContent {
6195    pub fn make_text(text: String) -> Self {
6196        Self::Text {
6197            text,
6198            undocumented: Default::default(),
6199        }
6200    }
6201
6202    pub fn make_link(text: String, preview: LinkPreview) -> Self {
6203        Self::Link {
6204            text,
6205            preview,
6206            undocumented: Default::default(),
6207        }
6208    }
6209
6210    pub fn make_image(text: String, image: String) -> Self {
6211        Self::Image {
6212            text,
6213            image,
6214            undocumented: Default::default(),
6215        }
6216    }
6217
6218    pub fn make_video(text: String, image: String, duration: i32) -> Self {
6219        Self::Video {
6220            text,
6221            image,
6222            duration,
6223            undocumented: Default::default(),
6224        }
6225    }
6226
6227    pub fn make_voice(text: String, duration: i32) -> Self {
6228        Self::Voice {
6229            text,
6230            duration,
6231            undocumented: Default::default(),
6232        }
6233    }
6234
6235    pub fn make_file(text: String) -> Self {
6236        Self::File {
6237            text,
6238            undocumented: Default::default(),
6239        }
6240    }
6241
6242    pub fn make_report(text: String, reason: ReportReason) -> Self {
6243        Self::Report {
6244            text,
6245            reason,
6246            undocumented: Default::default(),
6247        }
6248    }
6249
6250    pub fn make_chat(
6251        text: String,
6252        chat_link: MsgChatLink,
6253        owner_sig: Option<LinkOwnerSig>,
6254    ) -> Self {
6255        Self::Chat {
6256            text,
6257            chat_link,
6258            owner_sig,
6259            undocumented: Default::default(),
6260        }
6261    }
6262
6263    pub fn make_unknown(tag: String, text: String, json: JsonObject) -> Self {
6264        Self::Unknown {
6265            tag,
6266            text,
6267            json,
6268            undocumented: Default::default(),
6269        }
6270    }
6271}
6272
6273impl MsgContent {
6274    pub fn text(&self) -> Option<&String> {
6275        if let Self::Text { text, .. } = self {
6276            Some(text)
6277        } else {
6278            None
6279        }
6280    }
6281    pub fn link(&self) -> Option<MsgContentLinkRef<'_>> {
6282        if let Self::Link { text, preview, .. } = self {
6283            Some(MsgContentLinkRef { text, preview })
6284        } else {
6285            None
6286        }
6287    }
6288    pub fn image(&self) -> Option<MsgContentImageRef<'_>> {
6289        if let Self::Image { text, image, .. } = self {
6290            Some(MsgContentImageRef { text, image })
6291        } else {
6292            None
6293        }
6294    }
6295    pub fn video(&self) -> Option<MsgContentVideoRef<'_>> {
6296        if let Self::Video {
6297            text,
6298            image,
6299            duration,
6300            ..
6301        } = self
6302        {
6303            Some(MsgContentVideoRef {
6304                text,
6305                image,
6306                duration,
6307            })
6308        } else {
6309            None
6310        }
6311    }
6312    pub fn voice(&self) -> Option<MsgContentVoiceRef<'_>> {
6313        if let Self::Voice { text, duration, .. } = self {
6314            Some(MsgContentVoiceRef { text, duration })
6315        } else {
6316            None
6317        }
6318    }
6319    pub fn file(&self) -> Option<&String> {
6320        if let Self::File { text, .. } = self {
6321            Some(text)
6322        } else {
6323            None
6324        }
6325    }
6326    pub fn report(&self) -> Option<MsgContentReportRef<'_>> {
6327        if let Self::Report { text, reason, .. } = self {
6328            Some(MsgContentReportRef { text, reason })
6329        } else {
6330            None
6331        }
6332    }
6333    pub fn chat(&self) -> Option<MsgContentChatRef<'_>> {
6334        if let Self::Chat {
6335            text,
6336            chat_link,
6337            owner_sig,
6338            ..
6339        } = self
6340        {
6341            Some(MsgContentChatRef {
6342                text,
6343                chat_link,
6344                owner_sig,
6345            })
6346        } else {
6347            None
6348        }
6349    }
6350    pub fn unknown(&self) -> Option<MsgContentUnknownRef<'_>> {
6351        if let Self::Unknown {
6352            tag, text, json, ..
6353        } = self
6354        {
6355            Some(MsgContentUnknownRef { tag, text, json })
6356        } else {
6357            None
6358        }
6359    }
6360}
6361#[derive(Clone, Copy)]
6362pub struct MsgContentLinkRef<'a> {
6363    pub text: &'a String,
6364    pub preview: &'a LinkPreview,
6365}
6366#[derive(Clone, Copy)]
6367pub struct MsgContentImageRef<'a> {
6368    pub text: &'a String,
6369    pub image: &'a String,
6370}
6371#[derive(Clone, Copy)]
6372pub struct MsgContentVideoRef<'a> {
6373    pub text: &'a String,
6374    pub image: &'a String,
6375    pub duration: &'a i32,
6376}
6377#[derive(Clone, Copy)]
6378pub struct MsgContentVoiceRef<'a> {
6379    pub text: &'a String,
6380    pub duration: &'a i32,
6381}
6382#[derive(Clone, Copy)]
6383pub struct MsgContentReportRef<'a> {
6384    pub text: &'a String,
6385    pub reason: &'a ReportReason,
6386}
6387#[derive(Clone, Copy)]
6388pub struct MsgContentChatRef<'a> {
6389    pub text: &'a String,
6390    pub chat_link: &'a MsgChatLink,
6391    pub owner_sig: &'a Option<LinkOwnerSig>,
6392}
6393#[derive(Clone, Copy)]
6394pub struct MsgContentUnknownRef<'a> {
6395    pub tag: &'a String,
6396    pub text: &'a String,
6397    pub json: &'a JsonObject,
6398}
6399
6400#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6401#[non_exhaustive]
6402pub enum MsgDirection {
6403    #[default]
6404    #[serde(rename = "rcv")]
6405    Rcv,
6406    #[serde(rename = "snd")]
6407    Snd,
6408}
6409
6410#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6411#[non_exhaustive]
6412pub enum MsgFilter {
6413    #[default]
6414    #[serde(rename = "none")]
6415    None,
6416    #[serde(rename = "all")]
6417    All,
6418    #[serde(rename = "mentions")]
6419    Mentions,
6420}
6421
6422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6423#[serde(tag = "type")]
6424#[non_exhaustive]
6425pub enum MsgReaction {
6426    #[serde(rename = "emoji")]
6427    Emoji {
6428        #[serde(rename = "emoji")]
6429        emoji: String,
6430
6431        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6432        undocumented: JsonObject,
6433    },
6434    #[serde(rename = "unknown")]
6435    Unknown {
6436        #[serde(rename = "tag")]
6437        tag: String,
6438
6439        #[serde(rename = "json")]
6440        json: JsonObject,
6441
6442        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6443        undocumented: JsonObject,
6444    },
6445    #[serde(untagged)]
6446    Undocumented(JsonObject),
6447}
6448
6449impl MsgReaction {
6450    pub fn make_emoji(emoji: String) -> Self {
6451        Self::Emoji {
6452            emoji,
6453            undocumented: Default::default(),
6454        }
6455    }
6456
6457    pub fn make_unknown(tag: String, json: JsonObject) -> Self {
6458        Self::Unknown {
6459            tag,
6460            json,
6461            undocumented: Default::default(),
6462        }
6463    }
6464}
6465
6466impl MsgReaction {
6467    pub fn emoji(&self) -> Option<&String> {
6468        if let Self::Emoji { emoji, .. } = self {
6469            Some(emoji)
6470        } else {
6471            None
6472        }
6473    }
6474    pub fn unknown(&self) -> Option<MsgReactionUnknownRef<'_>> {
6475        if let Self::Unknown { tag, json, .. } = self {
6476            Some(MsgReactionUnknownRef { tag, json })
6477        } else {
6478            None
6479        }
6480    }
6481}
6482#[derive(Clone, Copy)]
6483pub struct MsgReactionUnknownRef<'a> {
6484    pub tag: &'a String,
6485    pub json: &'a JsonObject,
6486}
6487
6488#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6489#[non_exhaustive]
6490pub enum MsgReceiptStatus {
6491    #[default]
6492    #[serde(rename = "ok")]
6493    Ok,
6494    #[serde(rename = "badMsgHash")]
6495    BadMsgHash,
6496}
6497
6498#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6499#[non_exhaustive]
6500pub enum MsgSigStatus {
6501    #[default]
6502    #[serde(rename = "verified")]
6503    Verified,
6504    #[serde(rename = "signedNoKey")]
6505    SignedNoKey,
6506}
6507
6508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6509#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6510#[cfg_attr(feature = "bon", builder(on(String, into)))]
6511pub struct NewUser {
6512    #[serde(rename = "profile", skip_serializing_if = "Option::is_none")]
6513    pub profile: Option<Profile>,
6514
6515    #[serde(rename = "pastTimestamp", default)]
6516    pub past_timestamp: bool,
6517
6518    #[serde(rename = "userChatRelay", default)]
6519    pub user_chat_relay: bool,
6520
6521    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6522    #[cfg_attr(feature = "bon", builder(default))]
6523    pub undocumented: JsonObject,
6524}
6525
6526#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6527#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6528#[cfg_attr(feature = "bon", builder(on(String, into)))]
6529pub struct NoteFolder {
6530    #[serde(
6531        rename = "noteFolderId",
6532        deserialize_with = "deserialize_number_from_string"
6533    )]
6534    pub note_folder_id: i64,
6535
6536    #[serde(rename = "userId", deserialize_with = "deserialize_number_from_string")]
6537    pub user_id: i64,
6538
6539    #[serde(rename = "createdAt")]
6540    pub created_at: UtcTime,
6541
6542    #[serde(rename = "updatedAt")]
6543    pub updated_at: UtcTime,
6544
6545    #[serde(rename = "chatTs")]
6546    pub chat_ts: UtcTime,
6547
6548    #[serde(rename = "favorite", default)]
6549    pub favorite: bool,
6550
6551    #[serde(rename = "unread", default)]
6552    pub unread: bool,
6553
6554    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6555    #[cfg_attr(feature = "bon", builder(default))]
6556    pub undocumented: JsonObject,
6557}
6558
6559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6560#[serde(tag = "type")]
6561#[non_exhaustive]
6562pub enum OwnerVerification {
6563    #[serde(rename = "verified")]
6564    Verified,
6565    #[serde(rename = "failed")]
6566    Failed {
6567        #[serde(rename = "reason")]
6568        reason: String,
6569
6570        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6571        undocumented: JsonObject,
6572    },
6573    #[serde(untagged)]
6574    Undocumented(JsonObject),
6575}
6576
6577impl OwnerVerification {
6578    pub fn make_verified() -> Self {
6579        Self::Verified
6580    }
6581
6582    pub fn make_failed(reason: String) -> Self {
6583        Self::Failed {
6584            reason,
6585            undocumented: Default::default(),
6586        }
6587    }
6588}
6589
6590impl OwnerVerification {
6591    pub fn is_verified(&self) -> bool {
6592        matches!(self, Self::Verified)
6593    }
6594    pub fn failed(&self) -> Option<&String> {
6595        if let Self::Failed { reason, .. } = self {
6596            Some(reason)
6597        } else {
6598            None
6599        }
6600    }
6601}
6602
6603/// *Syntax:*
6604///
6605/// ```
6606/// count=<count>
6607/// ```
6608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6609#[serde(tag = "type")]
6610#[non_exhaustive]
6611pub enum PaginationByTime {
6612    #[serde(rename = "last")]
6613    Last {
6614        #[serde(rename = "count", deserialize_with = "deserialize_number_from_string")]
6615        count: i32,
6616
6617        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6618        undocumented: JsonObject,
6619    },
6620    #[serde(untagged)]
6621    Undocumented(JsonObject),
6622}
6623
6624impl CommandSyntax for PaginationByTime {
6625    const COMMAND_BUF_SIZE: usize = 32;
6626
6627    fn append_command_syntax(&self, buf: &mut String) {
6628        match self {
6629            Self::Last {
6630                count,
6631                undocumented: _,
6632            } => {
6633                buf.push_str("count=");
6634                write!(buf, "{count}").unwrap();
6635            }
6636            Self::Undocumented(_) => {}
6637        }
6638    }
6639}
6640
6641impl PaginationByTime {
6642    pub fn make_last(count: i32) -> Self {
6643        Self::Last {
6644            count,
6645            undocumented: Default::default(),
6646        }
6647    }
6648}
6649
6650impl PaginationByTime {
6651    pub fn last(&self) -> Option<&i32> {
6652        if let Self::Last { count, .. } = self {
6653            Some(count)
6654        } else {
6655            None
6656        }
6657    }
6658}
6659
6660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6661#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6662#[cfg_attr(feature = "bon", builder(on(String, into)))]
6663pub struct PendingContactConnection {
6664    #[serde(
6665        rename = "pccConnId",
6666        deserialize_with = "deserialize_number_from_string"
6667    )]
6668    pub pcc_conn_id: i64,
6669
6670    #[serde(rename = "pccAgentConnId")]
6671    pub pcc_agent_conn_id: String,
6672
6673    #[serde(rename = "pccConnStatus")]
6674    pub pcc_conn_status: ConnStatus,
6675
6676    #[serde(rename = "viaContactUri", default)]
6677    pub via_contact_uri: bool,
6678
6679    #[serde(
6680        rename = "viaUserContactLink",
6681        skip_serializing_if = "Option::is_none",
6682        deserialize_with = "deserialize_option_number_from_string",
6683        default
6684    )]
6685    pub via_user_contact_link: Option<i64>,
6686
6687    #[serde(rename = "groupLinkId", skip_serializing_if = "Option::is_none")]
6688    pub group_link_id: Option<String>,
6689
6690    #[serde(
6691        rename = "customUserProfileId",
6692        skip_serializing_if = "Option::is_none",
6693        deserialize_with = "deserialize_option_number_from_string",
6694        default
6695    )]
6696    pub custom_user_profile_id: Option<i64>,
6697
6698    #[serde(rename = "connLinkInv", skip_serializing_if = "Option::is_none")]
6699    pub conn_link_inv: Option<CreatedConnLink>,
6700
6701    #[serde(rename = "localAlias")]
6702    pub local_alias: String,
6703
6704    #[serde(rename = "createdAt")]
6705    pub created_at: UtcTime,
6706
6707    #[serde(rename = "updatedAt")]
6708    pub updated_at: UtcTime,
6709
6710    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6711    #[cfg_attr(feature = "bon", builder(default))]
6712    pub undocumented: JsonObject,
6713}
6714
6715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6716#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6717#[cfg_attr(feature = "bon", builder(on(String, into)))]
6718pub struct PrefEnabled {
6719    #[serde(rename = "forUser", default)]
6720    pub for_user: bool,
6721
6722    #[serde(rename = "forContact", default)]
6723    pub for_contact: bool,
6724
6725    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6726    #[cfg_attr(feature = "bon", builder(default))]
6727    pub undocumented: JsonObject,
6728}
6729
6730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6731#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6732#[cfg_attr(feature = "bon", builder(on(String, into)))]
6733pub struct Preferences {
6734    #[serde(rename = "timedMessages", skip_serializing_if = "Option::is_none")]
6735    pub timed_messages: Option<TimedMessagesPreference>,
6736
6737    #[serde(rename = "fullDelete", skip_serializing_if = "Option::is_none")]
6738    pub full_delete: Option<SimplePreference>,
6739
6740    #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
6741    pub reactions: Option<SimplePreference>,
6742
6743    #[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
6744    pub voice: Option<SimplePreference>,
6745
6746    #[serde(rename = "files", skip_serializing_if = "Option::is_none")]
6747    pub files: Option<SimplePreference>,
6748
6749    #[serde(rename = "calls", skip_serializing_if = "Option::is_none")]
6750    pub calls: Option<SimplePreference>,
6751
6752    #[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
6753    pub sessions: Option<SimplePreference>,
6754
6755    #[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
6756    pub commands: Option<Vec<ChatBotCommand>>,
6757
6758    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6759    #[cfg_attr(feature = "bon", builder(default))]
6760    pub undocumented: JsonObject,
6761}
6762
6763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6764#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6765#[cfg_attr(feature = "bon", builder(on(String, into)))]
6766pub struct PreparedContact {
6767    #[serde(rename = "connLinkToConnect")]
6768    pub conn_link_to_connect: CreatedConnLink,
6769
6770    #[serde(rename = "uiConnLinkType")]
6771    pub ui_conn_link_type: ConnectionMode,
6772
6773    #[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
6774    pub welcome_shared_msg_id: Option<String>,
6775
6776    #[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
6777    pub request_shared_msg_id: Option<String>,
6778
6779    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6780    #[cfg_attr(feature = "bon", builder(default))]
6781    pub undocumented: JsonObject,
6782}
6783
6784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6785#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6786#[cfg_attr(feature = "bon", builder(on(String, into)))]
6787pub struct PreparedGroup {
6788    #[serde(rename = "connLinkToConnect")]
6789    pub conn_link_to_connect: CreatedConnLink,
6790
6791    #[serde(rename = "connLinkPreparedConnection", default)]
6792    pub conn_link_prepared_connection: bool,
6793
6794    #[serde(rename = "connLinkStartedConnection", default)]
6795    pub conn_link_started_connection: bool,
6796
6797    #[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
6798    pub welcome_shared_msg_id: Option<String>,
6799
6800    #[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
6801    pub request_shared_msg_id: Option<String>,
6802
6803    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6804    #[cfg_attr(feature = "bon", builder(default))]
6805    pub undocumented: JsonObject,
6806}
6807
6808#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6809#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6810#[cfg_attr(feature = "bon", builder(on(String, into)))]
6811pub struct Profile {
6812    #[serde(rename = "displayName")]
6813    pub display_name: String,
6814
6815    #[serde(rename = "fullName")]
6816    pub full_name: String,
6817
6818    #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
6819    pub short_descr: Option<String>,
6820
6821    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
6822    pub image: Option<String>,
6823
6824    #[serde(rename = "contactLink", skip_serializing_if = "Option::is_none")]
6825    pub contact_link: Option<String>,
6826
6827    #[serde(rename = "preferences", skip_serializing_if = "Option::is_none")]
6828    pub preferences: Option<Preferences>,
6829
6830    #[serde(rename = "peerType", skip_serializing_if = "Option::is_none")]
6831    pub peer_type: Option<ChatPeerType>,
6832
6833    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6834    #[cfg_attr(feature = "bon", builder(default))]
6835    pub undocumented: JsonObject,
6836}
6837
6838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6839#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6840#[cfg_attr(feature = "bon", builder(on(String, into)))]
6841pub struct PublicGroupAccess {
6842    #[serde(rename = "groupWebPage", skip_serializing_if = "Option::is_none")]
6843    pub group_web_page: Option<String>,
6844
6845    #[serde(rename = "groupDomain", skip_serializing_if = "Option::is_none")]
6846    pub group_domain: Option<String>,
6847
6848    #[serde(rename = "domainWebPage", default)]
6849    pub domain_web_page: bool,
6850
6851    #[serde(rename = "allowEmbedding", default)]
6852    pub allow_embedding: bool,
6853
6854    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6855    #[cfg_attr(feature = "bon", builder(default))]
6856    pub undocumented: JsonObject,
6857}
6858
6859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6860#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6861#[cfg_attr(feature = "bon", builder(on(String, into)))]
6862pub struct PublicGroupData {
6863    #[serde(
6864        rename = "publicMemberCount",
6865        deserialize_with = "deserialize_number_from_string"
6866    )]
6867    pub public_member_count: i64,
6868
6869    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6870    #[cfg_attr(feature = "bon", builder(default))]
6871    pub undocumented: JsonObject,
6872}
6873
6874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6875#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6876#[cfg_attr(feature = "bon", builder(on(String, into)))]
6877pub struct PublicGroupProfile {
6878    #[serde(rename = "groupType")]
6879    pub group_type: GroupType,
6880
6881    #[serde(rename = "groupLink")]
6882    pub group_link: String,
6883
6884    #[serde(rename = "publicGroupId")]
6885    pub public_group_id: String,
6886
6887    #[serde(rename = "publicGroupAccess", skip_serializing_if = "Option::is_none")]
6888    pub public_group_access: Option<PublicGroupAccess>,
6889
6890    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6891    #[cfg_attr(feature = "bon", builder(default))]
6892    pub undocumented: JsonObject,
6893}
6894
6895#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6896#[non_exhaustive]
6897pub enum RatchetSyncState {
6898    #[default]
6899    #[serde(rename = "ok")]
6900    Ok,
6901    #[serde(rename = "allowed")]
6902    Allowed,
6903    #[serde(rename = "required")]
6904    Required,
6905    #[serde(rename = "started")]
6906    Started,
6907    #[serde(rename = "agreed")]
6908    Agreed,
6909}
6910
6911#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6912#[serde(tag = "type")]
6913#[non_exhaustive]
6914pub enum RcvConnEvent {
6915    #[serde(rename = "switchQueue")]
6916    SwitchQueue {
6917        #[serde(rename = "phase")]
6918        phase: SwitchPhase,
6919
6920        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6921        undocumented: JsonObject,
6922    },
6923    #[serde(rename = "ratchetSync")]
6924    RatchetSync {
6925        #[serde(rename = "syncStatus")]
6926        sync_status: RatchetSyncState,
6927
6928        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6929        undocumented: JsonObject,
6930    },
6931    #[serde(rename = "verificationCodeReset")]
6932    VerificationCodeReset,
6933    #[serde(rename = "pqEnabled")]
6934    PqEnabled {
6935        #[serde(rename = "enabled", default)]
6936        enabled: bool,
6937
6938        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6939        undocumented: JsonObject,
6940    },
6941    #[serde(untagged)]
6942    Undocumented(JsonObject),
6943}
6944
6945impl RcvConnEvent {
6946    pub fn make_switch_queue(phase: SwitchPhase) -> Self {
6947        Self::SwitchQueue {
6948            phase,
6949            undocumented: Default::default(),
6950        }
6951    }
6952
6953    pub fn make_ratchet_sync(sync_status: RatchetSyncState) -> Self {
6954        Self::RatchetSync {
6955            sync_status,
6956            undocumented: Default::default(),
6957        }
6958    }
6959
6960    pub fn make_verification_code_reset() -> Self {
6961        Self::VerificationCodeReset
6962    }
6963
6964    pub fn make_pq_enabled(enabled: bool) -> Self {
6965        Self::PqEnabled {
6966            enabled,
6967            undocumented: Default::default(),
6968        }
6969    }
6970}
6971
6972impl RcvConnEvent {
6973    pub fn switch_queue(&self) -> Option<&SwitchPhase> {
6974        if let Self::SwitchQueue { phase, .. } = self {
6975            Some(phase)
6976        } else {
6977            None
6978        }
6979    }
6980    pub fn ratchet_sync(&self) -> Option<&RatchetSyncState> {
6981        if let Self::RatchetSync { sync_status, .. } = self {
6982            Some(sync_status)
6983        } else {
6984            None
6985        }
6986    }
6987    pub fn is_verification_code_reset(&self) -> bool {
6988        matches!(self, Self::VerificationCodeReset)
6989    }
6990    pub fn pq_enabled(&self) -> Option<&bool> {
6991        if let Self::PqEnabled { enabled, .. } = self {
6992            Some(enabled)
6993        } else {
6994            None
6995        }
6996    }
6997}
6998
6999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7000#[serde(tag = "type")]
7001#[non_exhaustive]
7002pub enum RcvDirectEvent {
7003    #[serde(rename = "contactDeleted")]
7004    ContactDeleted,
7005    #[serde(rename = "profileUpdated")]
7006    ProfileUpdated {
7007        #[serde(rename = "fromProfile")]
7008        from_profile: Profile,
7009
7010        #[serde(rename = "toProfile")]
7011        to_profile: Profile,
7012
7013        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7014        undocumented: JsonObject,
7015    },
7016    #[serde(rename = "groupInvLinkReceived")]
7017    GroupInvLinkReceived {
7018        #[serde(rename = "groupProfile")]
7019        group_profile: GroupProfile,
7020
7021        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7022        undocumented: JsonObject,
7023    },
7024    #[serde(untagged)]
7025    Undocumented(JsonObject),
7026}
7027
7028impl RcvDirectEvent {
7029    pub fn make_contact_deleted() -> Self {
7030        Self::ContactDeleted
7031    }
7032
7033    pub fn make_profile_updated(from_profile: Profile, to_profile: Profile) -> Self {
7034        Self::ProfileUpdated {
7035            from_profile,
7036            to_profile,
7037            undocumented: Default::default(),
7038        }
7039    }
7040
7041    pub fn make_group_inv_link_received(group_profile: GroupProfile) -> Self {
7042        Self::GroupInvLinkReceived {
7043            group_profile,
7044            undocumented: Default::default(),
7045        }
7046    }
7047}
7048
7049impl RcvDirectEvent {
7050    pub fn is_contact_deleted(&self) -> bool {
7051        matches!(self, Self::ContactDeleted)
7052    }
7053    pub fn profile_updated(&self) -> Option<RcvDirectEventProfileUpdatedRef<'_>> {
7054        if let Self::ProfileUpdated {
7055            from_profile,
7056            to_profile,
7057            ..
7058        } = self
7059        {
7060            Some(RcvDirectEventProfileUpdatedRef {
7061                from_profile,
7062                to_profile,
7063            })
7064        } else {
7065            None
7066        }
7067    }
7068    pub fn group_inv_link_received(&self) -> Option<&GroupProfile> {
7069        if let Self::GroupInvLinkReceived { group_profile, .. } = self {
7070            Some(group_profile)
7071        } else {
7072            None
7073        }
7074    }
7075}
7076#[derive(Clone, Copy)]
7077pub struct RcvDirectEventProfileUpdatedRef<'a> {
7078    pub from_profile: &'a Profile,
7079    pub to_profile: &'a Profile,
7080}
7081
7082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7083#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7084#[cfg_attr(feature = "bon", builder(on(String, into)))]
7085pub struct RcvFileDescr {
7086    #[serde(
7087        rename = "fileDescrId",
7088        deserialize_with = "deserialize_number_from_string"
7089    )]
7090    pub file_descr_id: i64,
7091
7092    #[serde(rename = "fileDescrText")]
7093    pub file_descr_text: String,
7094
7095    #[serde(
7096        rename = "fileDescrPartNo",
7097        deserialize_with = "deserialize_number_from_string"
7098    )]
7099    pub file_descr_part_no: i32,
7100
7101    #[serde(rename = "fileDescrComplete", default)]
7102    pub file_descr_complete: bool,
7103
7104    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7105    #[cfg_attr(feature = "bon", builder(default))]
7106    pub undocumented: JsonObject,
7107}
7108
7109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7110#[serde(tag = "type")]
7111#[non_exhaustive]
7112pub enum RcvFileStatus {
7113    #[serde(rename = "new")]
7114    New,
7115    #[serde(rename = "accepted")]
7116    Accepted {
7117        #[serde(rename = "filePath")]
7118        file_path: String,
7119
7120        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7121        undocumented: JsonObject,
7122    },
7123    #[serde(rename = "connected")]
7124    Connected {
7125        #[serde(rename = "filePath")]
7126        file_path: String,
7127
7128        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7129        undocumented: JsonObject,
7130    },
7131    #[serde(rename = "complete")]
7132    Complete {
7133        #[serde(rename = "filePath")]
7134        file_path: String,
7135
7136        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7137        undocumented: JsonObject,
7138    },
7139    #[serde(rename = "cancelled")]
7140    Cancelled {
7141        #[serde(rename = "filePath_", skip_serializing_if = "Option::is_none")]
7142        file_path: Option<String>,
7143
7144        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7145        undocumented: JsonObject,
7146    },
7147    #[serde(untagged)]
7148    Undocumented(JsonObject),
7149}
7150
7151impl RcvFileStatus {
7152    pub fn make_new() -> Self {
7153        Self::New
7154    }
7155
7156    pub fn make_accepted(file_path: String) -> Self {
7157        Self::Accepted {
7158            file_path,
7159            undocumented: Default::default(),
7160        }
7161    }
7162
7163    pub fn make_connected(file_path: String) -> Self {
7164        Self::Connected {
7165            file_path,
7166            undocumented: Default::default(),
7167        }
7168    }
7169
7170    pub fn make_complete(file_path: String) -> Self {
7171        Self::Complete {
7172            file_path,
7173            undocumented: Default::default(),
7174        }
7175    }
7176
7177    pub fn make_cancelled(file_path: Option<String>) -> Self {
7178        Self::Cancelled {
7179            file_path,
7180            undocumented: Default::default(),
7181        }
7182    }
7183}
7184
7185impl RcvFileStatus {
7186    pub fn is_new(&self) -> bool {
7187        matches!(self, Self::New)
7188    }
7189    pub fn accepted(&self) -> Option<&String> {
7190        if let Self::Accepted { file_path, .. } = self {
7191            Some(file_path)
7192        } else {
7193            None
7194        }
7195    }
7196    pub fn connected(&self) -> Option<&String> {
7197        if let Self::Connected { file_path, .. } = self {
7198            Some(file_path)
7199        } else {
7200            None
7201        }
7202    }
7203    pub fn complete(&self) -> Option<&String> {
7204        if let Self::Complete { file_path, .. } = self {
7205            Some(file_path)
7206        } else {
7207            None
7208        }
7209    }
7210    pub fn cancelled(&self) -> Option<&Option<String>> {
7211        if let Self::Cancelled { file_path, .. } = self {
7212            Some(file_path)
7213        } else {
7214            None
7215        }
7216    }
7217}
7218
7219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7220#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7221#[cfg_attr(feature = "bon", builder(on(String, into)))]
7222pub struct RcvFileTransfer {
7223    #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
7224    pub file_id: i64,
7225
7226    #[serde(rename = "xftpRcvFile", skip_serializing_if = "Option::is_none")]
7227    pub xftp_rcv_file: Option<XFTPRcvFile>,
7228
7229    #[serde(rename = "fileInvitation")]
7230    pub file_invitation: FileInvitation,
7231
7232    #[serde(rename = "fileStatus")]
7233    pub file_status: RcvFileStatus,
7234
7235    #[serde(rename = "rcvFileInline", skip_serializing_if = "Option::is_none")]
7236    pub rcv_file_inline: Option<InlineFileMode>,
7237
7238    #[serde(rename = "senderDisplayName")]
7239    pub sender_display_name: String,
7240
7241    #[serde(
7242        rename = "chunkSize",
7243        deserialize_with = "deserialize_number_from_string"
7244    )]
7245    pub chunk_size: i64,
7246
7247    #[serde(rename = "cancelled", default)]
7248    pub cancelled: bool,
7249
7250    #[serde(
7251        rename = "grpMemberId",
7252        skip_serializing_if = "Option::is_none",
7253        deserialize_with = "deserialize_option_number_from_string",
7254        default
7255    )]
7256    pub grp_member_id: Option<i64>,
7257
7258    #[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
7259    pub crypto_args: Option<CryptoFileArgs>,
7260
7261    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7262    #[cfg_attr(feature = "bon", builder(default))]
7263    pub undocumented: JsonObject,
7264}
7265
7266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7267#[serde(tag = "type")]
7268#[non_exhaustive]
7269pub enum RcvGroupEvent {
7270    #[serde(rename = "memberAdded")]
7271    MemberAdded {
7272        #[serde(
7273            rename = "groupMemberId",
7274            deserialize_with = "deserialize_number_from_string"
7275        )]
7276        group_member_id: i64,
7277
7278        #[serde(rename = "profile")]
7279        profile: Profile,
7280
7281        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7282        undocumented: JsonObject,
7283    },
7284    #[serde(rename = "memberConnected")]
7285    MemberConnected,
7286    #[serde(rename = "memberAccepted")]
7287    MemberAccepted {
7288        #[serde(
7289            rename = "groupMemberId",
7290            deserialize_with = "deserialize_number_from_string"
7291        )]
7292        group_member_id: i64,
7293
7294        #[serde(rename = "profile")]
7295        profile: Profile,
7296
7297        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7298        undocumented: JsonObject,
7299    },
7300    #[serde(rename = "userAccepted")]
7301    UserAccepted,
7302    #[serde(rename = "memberLeft")]
7303    MemberLeft,
7304    #[serde(rename = "memberRole")]
7305    MemberRole {
7306        #[serde(
7307            rename = "groupMemberId",
7308            deserialize_with = "deserialize_number_from_string"
7309        )]
7310        group_member_id: i64,
7311
7312        #[serde(rename = "profile")]
7313        profile: Profile,
7314
7315        #[serde(rename = "role")]
7316        role: GroupMemberRole,
7317
7318        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7319        undocumented: JsonObject,
7320    },
7321    #[serde(rename = "memberBlocked")]
7322    MemberBlocked {
7323        #[serde(
7324            rename = "groupMemberId",
7325            deserialize_with = "deserialize_number_from_string"
7326        )]
7327        group_member_id: i64,
7328
7329        #[serde(rename = "profile")]
7330        profile: Profile,
7331
7332        #[serde(rename = "blocked", default)]
7333        blocked: bool,
7334
7335        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7336        undocumented: JsonObject,
7337    },
7338    #[serde(rename = "userRole")]
7339    UserRole {
7340        #[serde(rename = "role")]
7341        role: GroupMemberRole,
7342
7343        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7344        undocumented: JsonObject,
7345    },
7346    #[serde(rename = "memberDeleted")]
7347    MemberDeleted {
7348        #[serde(
7349            rename = "groupMemberId",
7350            deserialize_with = "deserialize_number_from_string"
7351        )]
7352        group_member_id: i64,
7353
7354        #[serde(rename = "profile")]
7355        profile: Profile,
7356
7357        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7358        undocumented: JsonObject,
7359    },
7360    #[serde(rename = "userDeleted")]
7361    UserDeleted,
7362    #[serde(rename = "groupDeleted")]
7363    GroupDeleted,
7364    #[serde(rename = "groupUpdated")]
7365    GroupUpdated {
7366        #[serde(rename = "groupProfile")]
7367        group_profile: GroupProfile,
7368
7369        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7370        undocumented: JsonObject,
7371    },
7372    #[serde(rename = "invitedViaGroupLink")]
7373    InvitedViaGroupLink,
7374    #[serde(rename = "memberCreatedContact")]
7375    MemberCreatedContact,
7376    #[serde(rename = "memberProfileUpdated")]
7377    MemberProfileUpdated {
7378        #[serde(rename = "fromProfile")]
7379        from_profile: Profile,
7380
7381        #[serde(rename = "toProfile")]
7382        to_profile: Profile,
7383
7384        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7385        undocumented: JsonObject,
7386    },
7387    #[serde(rename = "newMemberPendingReview")]
7388    NewMemberPendingReview,
7389    #[serde(rename = "msgBadSignature")]
7390    MsgBadSignature,
7391    #[serde(untagged)]
7392    Undocumented(JsonObject),
7393}
7394
7395impl RcvGroupEvent {
7396    pub fn make_member_added(group_member_id: i64, profile: Profile) -> Self {
7397        Self::MemberAdded {
7398            group_member_id,
7399            profile,
7400            undocumented: Default::default(),
7401        }
7402    }
7403
7404    pub fn make_member_connected() -> Self {
7405        Self::MemberConnected
7406    }
7407
7408    pub fn make_member_accepted(group_member_id: i64, profile: Profile) -> Self {
7409        Self::MemberAccepted {
7410            group_member_id,
7411            profile,
7412            undocumented: Default::default(),
7413        }
7414    }
7415
7416    pub fn make_user_accepted() -> Self {
7417        Self::UserAccepted
7418    }
7419
7420    pub fn make_member_left() -> Self {
7421        Self::MemberLeft
7422    }
7423
7424    pub fn make_member_role(group_member_id: i64, profile: Profile, role: GroupMemberRole) -> Self {
7425        Self::MemberRole {
7426            group_member_id,
7427            profile,
7428            role,
7429            undocumented: Default::default(),
7430        }
7431    }
7432
7433    pub fn make_member_blocked(group_member_id: i64, profile: Profile, blocked: bool) -> Self {
7434        Self::MemberBlocked {
7435            group_member_id,
7436            profile,
7437            blocked,
7438            undocumented: Default::default(),
7439        }
7440    }
7441
7442    pub fn make_user_role(role: GroupMemberRole) -> Self {
7443        Self::UserRole {
7444            role,
7445            undocumented: Default::default(),
7446        }
7447    }
7448
7449    pub fn make_member_deleted(group_member_id: i64, profile: Profile) -> Self {
7450        Self::MemberDeleted {
7451            group_member_id,
7452            profile,
7453            undocumented: Default::default(),
7454        }
7455    }
7456
7457    pub fn make_user_deleted() -> Self {
7458        Self::UserDeleted
7459    }
7460
7461    pub fn make_group_deleted() -> Self {
7462        Self::GroupDeleted
7463    }
7464
7465    pub fn make_group_updated(group_profile: GroupProfile) -> Self {
7466        Self::GroupUpdated {
7467            group_profile,
7468            undocumented: Default::default(),
7469        }
7470    }
7471
7472    pub fn make_invited_via_group_link() -> Self {
7473        Self::InvitedViaGroupLink
7474    }
7475
7476    pub fn make_member_created_contact() -> Self {
7477        Self::MemberCreatedContact
7478    }
7479
7480    pub fn make_member_profile_updated(from_profile: Profile, to_profile: Profile) -> Self {
7481        Self::MemberProfileUpdated {
7482            from_profile,
7483            to_profile,
7484            undocumented: Default::default(),
7485        }
7486    }
7487
7488    pub fn make_new_member_pending_review() -> Self {
7489        Self::NewMemberPendingReview
7490    }
7491
7492    pub fn make_msg_bad_signature() -> Self {
7493        Self::MsgBadSignature
7494    }
7495}
7496
7497impl RcvGroupEvent {
7498    pub fn member_added(&self) -> Option<RcvGroupEventMemberAddedRef<'_>> {
7499        if let Self::MemberAdded {
7500            group_member_id,
7501            profile,
7502            ..
7503        } = self
7504        {
7505            Some(RcvGroupEventMemberAddedRef {
7506                group_member_id,
7507                profile,
7508            })
7509        } else {
7510            None
7511        }
7512    }
7513    pub fn is_member_connected(&self) -> bool {
7514        matches!(self, Self::MemberConnected)
7515    }
7516    pub fn member_accepted(&self) -> Option<RcvGroupEventMemberAcceptedRef<'_>> {
7517        if let Self::MemberAccepted {
7518            group_member_id,
7519            profile,
7520            ..
7521        } = self
7522        {
7523            Some(RcvGroupEventMemberAcceptedRef {
7524                group_member_id,
7525                profile,
7526            })
7527        } else {
7528            None
7529        }
7530    }
7531    pub fn is_user_accepted(&self) -> bool {
7532        matches!(self, Self::UserAccepted)
7533    }
7534    pub fn is_member_left(&self) -> bool {
7535        matches!(self, Self::MemberLeft)
7536    }
7537    pub fn member_role(&self) -> Option<RcvGroupEventMemberRoleRef<'_>> {
7538        if let Self::MemberRole {
7539            group_member_id,
7540            profile,
7541            role,
7542            ..
7543        } = self
7544        {
7545            Some(RcvGroupEventMemberRoleRef {
7546                group_member_id,
7547                profile,
7548                role,
7549            })
7550        } else {
7551            None
7552        }
7553    }
7554    pub fn member_blocked(&self) -> Option<RcvGroupEventMemberBlockedRef<'_>> {
7555        if let Self::MemberBlocked {
7556            group_member_id,
7557            profile,
7558            blocked,
7559            ..
7560        } = self
7561        {
7562            Some(RcvGroupEventMemberBlockedRef {
7563                group_member_id,
7564                profile,
7565                blocked,
7566            })
7567        } else {
7568            None
7569        }
7570    }
7571    pub fn user_role(&self) -> Option<&GroupMemberRole> {
7572        if let Self::UserRole { role, .. } = self {
7573            Some(role)
7574        } else {
7575            None
7576        }
7577    }
7578    pub fn member_deleted(&self) -> Option<RcvGroupEventMemberDeletedRef<'_>> {
7579        if let Self::MemberDeleted {
7580            group_member_id,
7581            profile,
7582            ..
7583        } = self
7584        {
7585            Some(RcvGroupEventMemberDeletedRef {
7586                group_member_id,
7587                profile,
7588            })
7589        } else {
7590            None
7591        }
7592    }
7593    pub fn is_user_deleted(&self) -> bool {
7594        matches!(self, Self::UserDeleted)
7595    }
7596    pub fn is_group_deleted(&self) -> bool {
7597        matches!(self, Self::GroupDeleted)
7598    }
7599    pub fn group_updated(&self) -> Option<&GroupProfile> {
7600        if let Self::GroupUpdated { group_profile, .. } = self {
7601            Some(group_profile)
7602        } else {
7603            None
7604        }
7605    }
7606    pub fn is_invited_via_group_link(&self) -> bool {
7607        matches!(self, Self::InvitedViaGroupLink)
7608    }
7609    pub fn is_member_created_contact(&self) -> bool {
7610        matches!(self, Self::MemberCreatedContact)
7611    }
7612    pub fn member_profile_updated(&self) -> Option<RcvGroupEventMemberProfileUpdatedRef<'_>> {
7613        if let Self::MemberProfileUpdated {
7614            from_profile,
7615            to_profile,
7616            ..
7617        } = self
7618        {
7619            Some(RcvGroupEventMemberProfileUpdatedRef {
7620                from_profile,
7621                to_profile,
7622            })
7623        } else {
7624            None
7625        }
7626    }
7627    pub fn is_new_member_pending_review(&self) -> bool {
7628        matches!(self, Self::NewMemberPendingReview)
7629    }
7630    pub fn is_msg_bad_signature(&self) -> bool {
7631        matches!(self, Self::MsgBadSignature)
7632    }
7633}
7634#[derive(Clone, Copy)]
7635pub struct RcvGroupEventMemberAddedRef<'a> {
7636    pub group_member_id: &'a i64,
7637    pub profile: &'a Profile,
7638}
7639#[derive(Clone, Copy)]
7640pub struct RcvGroupEventMemberAcceptedRef<'a> {
7641    pub group_member_id: &'a i64,
7642    pub profile: &'a Profile,
7643}
7644#[derive(Clone, Copy)]
7645pub struct RcvGroupEventMemberRoleRef<'a> {
7646    pub group_member_id: &'a i64,
7647    pub profile: &'a Profile,
7648    pub role: &'a GroupMemberRole,
7649}
7650#[derive(Clone, Copy)]
7651pub struct RcvGroupEventMemberBlockedRef<'a> {
7652    pub group_member_id: &'a i64,
7653    pub profile: &'a Profile,
7654    pub blocked: &'a bool,
7655}
7656#[derive(Clone, Copy)]
7657pub struct RcvGroupEventMemberDeletedRef<'a> {
7658    pub group_member_id: &'a i64,
7659    pub profile: &'a Profile,
7660}
7661#[derive(Clone, Copy)]
7662pub struct RcvGroupEventMemberProfileUpdatedRef<'a> {
7663    pub from_profile: &'a Profile,
7664    pub to_profile: &'a Profile,
7665}
7666
7667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7668#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7669#[cfg_attr(feature = "bon", builder(on(String, into)))]
7670pub struct RelayCapabilities {
7671    #[serde(rename = "webDomain", skip_serializing_if = "Option::is_none")]
7672    pub web_domain: Option<String>,
7673
7674    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7675    #[cfg_attr(feature = "bon", builder(default))]
7676    pub undocumented: JsonObject,
7677}
7678
7679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7680#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7681#[cfg_attr(feature = "bon", builder(on(String, into)))]
7682pub struct RelayProfile {
7683    #[serde(rename = "displayName")]
7684    pub display_name: String,
7685
7686    #[serde(rename = "fullName")]
7687    pub full_name: String,
7688
7689    #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
7690    pub short_descr: Option<String>,
7691
7692    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
7693    pub image: Option<String>,
7694
7695    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7696    #[cfg_attr(feature = "bon", builder(default))]
7697    pub undocumented: JsonObject,
7698}
7699
7700#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7701#[non_exhaustive]
7702pub enum RelayStatus {
7703    #[default]
7704    #[serde(rename = "new")]
7705    New,
7706    #[serde(rename = "invited")]
7707    Invited,
7708    #[serde(rename = "accepted")]
7709    Accepted,
7710    #[serde(rename = "active")]
7711    Active,
7712    #[serde(rename = "inactive")]
7713    Inactive,
7714    #[serde(rename = "rejected")]
7715    Rejected,
7716}
7717
7718#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7719#[non_exhaustive]
7720pub enum ReportReason {
7721    #[default]
7722    #[serde(rename = "spam")]
7723    Spam,
7724    #[serde(rename = "content")]
7725    Content,
7726    #[serde(rename = "community")]
7727    Community,
7728    #[serde(rename = "profile")]
7729    Profile,
7730    #[serde(rename = "other")]
7731    Other,
7732}
7733
7734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7735#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7736#[cfg_attr(feature = "bon", builder(on(String, into)))]
7737pub struct RoleGroupPreference {
7738    #[serde(rename = "enable")]
7739    pub enable: GroupFeatureEnabled,
7740
7741    #[serde(rename = "role", skip_serializing_if = "Option::is_none")]
7742    pub role: Option<GroupMemberRole>,
7743
7744    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7745    #[cfg_attr(feature = "bon", builder(default))]
7746    pub undocumented: JsonObject,
7747}
7748
7749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7750#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7751#[cfg_attr(feature = "bon", builder(on(String, into)))]
7752pub struct SecurityCode {
7753    #[serde(rename = "securityCode")]
7754    pub security_code: String,
7755
7756    #[serde(rename = "verifiedAt")]
7757    pub verified_at: UtcTime,
7758
7759    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7760    #[cfg_attr(feature = "bon", builder(default))]
7761    pub undocumented: JsonObject,
7762}
7763
7764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7765#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7766#[cfg_attr(feature = "bon", builder(on(String, into)))]
7767pub struct SimplePreference {
7768    #[serde(rename = "allow")]
7769    pub allow: FeatureAllowed,
7770
7771    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7772    #[cfg_attr(feature = "bon", builder(default))]
7773    pub undocumented: JsonObject,
7774}
7775
7776#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7777#[non_exhaustive]
7778pub enum SimplexLinkType {
7779    #[default]
7780    #[serde(rename = "contact")]
7781    Contact,
7782    #[serde(rename = "invitation")]
7783    Invitation,
7784    #[serde(rename = "group")]
7785    Group,
7786    #[serde(rename = "channel")]
7787    Channel,
7788    #[serde(rename = "relay")]
7789    Relay,
7790}
7791
7792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7793#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7794#[cfg_attr(feature = "bon", builder(on(String, into)))]
7795pub struct SimplexNameDomain {
7796    #[serde(rename = "nameTLD")]
7797    pub name_tld: SimplexTLD,
7798
7799    #[serde(rename = "domain")]
7800    pub domain: String,
7801
7802    #[serde(rename = "subDomain")]
7803    pub sub_domain: Vec<String>,
7804
7805    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7806    #[cfg_attr(feature = "bon", builder(default))]
7807    pub undocumented: JsonObject,
7808}
7809
7810#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7811#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7812#[cfg_attr(feature = "bon", builder(on(String, into)))]
7813pub struct SimplexNameInfo {
7814    #[serde(rename = "nameType")]
7815    pub name_type: SimplexNameType,
7816
7817    #[serde(rename = "nameDomain")]
7818    pub name_domain: SimplexNameDomain,
7819
7820    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7821    #[cfg_attr(feature = "bon", builder(default))]
7822    pub undocumented: JsonObject,
7823}
7824
7825#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7826#[non_exhaustive]
7827pub enum SimplexNameType {
7828    #[default]
7829    #[serde(rename = "publicGroup")]
7830    PublicGroup,
7831    #[serde(rename = "contact")]
7832    Contact,
7833}
7834
7835#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7836#[non_exhaustive]
7837pub enum SimplexTLD {
7838    #[default]
7839    #[serde(rename = "simplex")]
7840    Simplex,
7841    #[serde(rename = "testing")]
7842    Testing,
7843    #[serde(rename = "web")]
7844    Web,
7845}
7846
7847#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7848#[non_exhaustive]
7849pub enum SndCIStatusProgress {
7850    #[default]
7851    #[serde(rename = "partial")]
7852    Partial,
7853    #[serde(rename = "complete")]
7854    Complete,
7855}
7856
7857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7858#[serde(tag = "type")]
7859#[non_exhaustive]
7860pub enum SndConnEvent {
7861    #[serde(rename = "switchQueue")]
7862    SwitchQueue {
7863        #[serde(rename = "phase")]
7864        phase: SwitchPhase,
7865
7866        #[serde(rename = "member", skip_serializing_if = "Option::is_none")]
7867        member: Option<GroupMemberRef>,
7868
7869        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7870        undocumented: JsonObject,
7871    },
7872    #[serde(rename = "ratchetSync")]
7873    RatchetSync {
7874        #[serde(rename = "syncStatus")]
7875        sync_status: RatchetSyncState,
7876
7877        #[serde(rename = "member", skip_serializing_if = "Option::is_none")]
7878        member: Option<GroupMemberRef>,
7879
7880        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7881        undocumented: JsonObject,
7882    },
7883    #[serde(rename = "pqEnabled")]
7884    PqEnabled {
7885        #[serde(rename = "enabled", default)]
7886        enabled: bool,
7887
7888        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7889        undocumented: JsonObject,
7890    },
7891    #[serde(untagged)]
7892    Undocumented(JsonObject),
7893}
7894
7895impl SndConnEvent {
7896    pub fn make_switch_queue(phase: SwitchPhase, member: Option<GroupMemberRef>) -> Self {
7897        Self::SwitchQueue {
7898            phase,
7899            member,
7900            undocumented: Default::default(),
7901        }
7902    }
7903
7904    pub fn make_ratchet_sync(
7905        sync_status: RatchetSyncState,
7906        member: Option<GroupMemberRef>,
7907    ) -> Self {
7908        Self::RatchetSync {
7909            sync_status,
7910            member,
7911            undocumented: Default::default(),
7912        }
7913    }
7914
7915    pub fn make_pq_enabled(enabled: bool) -> Self {
7916        Self::PqEnabled {
7917            enabled,
7918            undocumented: Default::default(),
7919        }
7920    }
7921}
7922
7923impl SndConnEvent {
7924    pub fn switch_queue(&self) -> Option<SndConnEventSwitchQueueRef<'_>> {
7925        if let Self::SwitchQueue { phase, member, .. } = self {
7926            Some(SndConnEventSwitchQueueRef { phase, member })
7927        } else {
7928            None
7929        }
7930    }
7931    pub fn ratchet_sync(&self) -> Option<SndConnEventRatchetSyncRef<'_>> {
7932        if let Self::RatchetSync {
7933            sync_status,
7934            member,
7935            ..
7936        } = self
7937        {
7938            Some(SndConnEventRatchetSyncRef {
7939                sync_status,
7940                member,
7941            })
7942        } else {
7943            None
7944        }
7945    }
7946    pub fn pq_enabled(&self) -> Option<&bool> {
7947        if let Self::PqEnabled { enabled, .. } = self {
7948            Some(enabled)
7949        } else {
7950            None
7951        }
7952    }
7953}
7954#[derive(Clone, Copy)]
7955pub struct SndConnEventSwitchQueueRef<'a> {
7956    pub phase: &'a SwitchPhase,
7957    pub member: &'a Option<GroupMemberRef>,
7958}
7959#[derive(Clone, Copy)]
7960pub struct SndConnEventRatchetSyncRef<'a> {
7961    pub sync_status: &'a RatchetSyncState,
7962    pub member: &'a Option<GroupMemberRef>,
7963}
7964
7965#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7966#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7967#[cfg_attr(feature = "bon", builder(on(String, into)))]
7968pub struct SndFileTransfer {
7969    #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
7970    pub file_id: i64,
7971
7972    #[serde(rename = "fileName")]
7973    pub file_name: String,
7974
7975    #[serde(rename = "filePath")]
7976    pub file_path: String,
7977
7978    #[serde(
7979        rename = "fileSize",
7980        deserialize_with = "deserialize_number_from_string"
7981    )]
7982    pub file_size: i64,
7983
7984    #[serde(
7985        rename = "chunkSize",
7986        deserialize_with = "deserialize_number_from_string"
7987    )]
7988    pub chunk_size: i64,
7989
7990    #[serde(rename = "recipientDisplayName")]
7991    pub recipient_display_name: String,
7992
7993    #[serde(rename = "connId", deserialize_with = "deserialize_number_from_string")]
7994    pub conn_id: i64,
7995
7996    #[serde(rename = "agentConnId")]
7997    pub agent_conn_id: String,
7998
7999    #[serde(
8000        rename = "groupMemberId",
8001        skip_serializing_if = "Option::is_none",
8002        deserialize_with = "deserialize_option_number_from_string",
8003        default
8004    )]
8005    pub group_member_id: Option<i64>,
8006
8007    #[serde(rename = "fileStatus")]
8008    pub file_status: FileStatus,
8009
8010    #[serde(
8011        rename = "fileDescrId",
8012        skip_serializing_if = "Option::is_none",
8013        deserialize_with = "deserialize_option_number_from_string",
8014        default
8015    )]
8016    pub file_descr_id: Option<i64>,
8017
8018    #[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
8019    pub file_inline: Option<InlineFileMode>,
8020
8021    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8022    #[cfg_attr(feature = "bon", builder(default))]
8023    pub undocumented: JsonObject,
8024}
8025
8026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8027#[serde(tag = "type")]
8028#[non_exhaustive]
8029pub enum SndGroupEvent {
8030    #[serde(rename = "memberRole")]
8031    MemberRole {
8032        #[serde(
8033            rename = "groupMemberId",
8034            deserialize_with = "deserialize_number_from_string"
8035        )]
8036        group_member_id: i64,
8037
8038        #[serde(rename = "profile")]
8039        profile: Profile,
8040
8041        #[serde(rename = "role")]
8042        role: GroupMemberRole,
8043
8044        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8045        undocumented: JsonObject,
8046    },
8047    #[serde(rename = "memberBlocked")]
8048    MemberBlocked {
8049        #[serde(
8050            rename = "groupMemberId",
8051            deserialize_with = "deserialize_number_from_string"
8052        )]
8053        group_member_id: i64,
8054
8055        #[serde(rename = "profile")]
8056        profile: Profile,
8057
8058        #[serde(rename = "blocked", default)]
8059        blocked: bool,
8060
8061        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8062        undocumented: JsonObject,
8063    },
8064    #[serde(rename = "userRole")]
8065    UserRole {
8066        #[serde(rename = "role")]
8067        role: GroupMemberRole,
8068
8069        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8070        undocumented: JsonObject,
8071    },
8072    #[serde(rename = "memberDeleted")]
8073    MemberDeleted {
8074        #[serde(
8075            rename = "groupMemberId",
8076            deserialize_with = "deserialize_number_from_string"
8077        )]
8078        group_member_id: i64,
8079
8080        #[serde(rename = "profile")]
8081        profile: Profile,
8082
8083        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8084        undocumented: JsonObject,
8085    },
8086    #[serde(rename = "userLeft")]
8087    UserLeft,
8088    #[serde(rename = "groupUpdated")]
8089    GroupUpdated {
8090        #[serde(rename = "groupProfile")]
8091        group_profile: GroupProfile,
8092
8093        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8094        undocumented: JsonObject,
8095    },
8096    #[serde(rename = "memberAccepted")]
8097    MemberAccepted {
8098        #[serde(
8099            rename = "groupMemberId",
8100            deserialize_with = "deserialize_number_from_string"
8101        )]
8102        group_member_id: i64,
8103
8104        #[serde(rename = "profile")]
8105        profile: Profile,
8106
8107        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8108        undocumented: JsonObject,
8109    },
8110    #[serde(rename = "userPendingReview")]
8111    UserPendingReview,
8112    #[serde(untagged)]
8113    Undocumented(JsonObject),
8114}
8115
8116impl SndGroupEvent {
8117    pub fn make_member_role(group_member_id: i64, profile: Profile, role: GroupMemberRole) -> Self {
8118        Self::MemberRole {
8119            group_member_id,
8120            profile,
8121            role,
8122            undocumented: Default::default(),
8123        }
8124    }
8125
8126    pub fn make_member_blocked(group_member_id: i64, profile: Profile, blocked: bool) -> Self {
8127        Self::MemberBlocked {
8128            group_member_id,
8129            profile,
8130            blocked,
8131            undocumented: Default::default(),
8132        }
8133    }
8134
8135    pub fn make_user_role(role: GroupMemberRole) -> Self {
8136        Self::UserRole {
8137            role,
8138            undocumented: Default::default(),
8139        }
8140    }
8141
8142    pub fn make_member_deleted(group_member_id: i64, profile: Profile) -> Self {
8143        Self::MemberDeleted {
8144            group_member_id,
8145            profile,
8146            undocumented: Default::default(),
8147        }
8148    }
8149
8150    pub fn make_user_left() -> Self {
8151        Self::UserLeft
8152    }
8153
8154    pub fn make_group_updated(group_profile: GroupProfile) -> Self {
8155        Self::GroupUpdated {
8156            group_profile,
8157            undocumented: Default::default(),
8158        }
8159    }
8160
8161    pub fn make_member_accepted(group_member_id: i64, profile: Profile) -> Self {
8162        Self::MemberAccepted {
8163            group_member_id,
8164            profile,
8165            undocumented: Default::default(),
8166        }
8167    }
8168
8169    pub fn make_user_pending_review() -> Self {
8170        Self::UserPendingReview
8171    }
8172}
8173
8174impl SndGroupEvent {
8175    pub fn member_role(&self) -> Option<SndGroupEventMemberRoleRef<'_>> {
8176        if let Self::MemberRole {
8177            group_member_id,
8178            profile,
8179            role,
8180            ..
8181        } = self
8182        {
8183            Some(SndGroupEventMemberRoleRef {
8184                group_member_id,
8185                profile,
8186                role,
8187            })
8188        } else {
8189            None
8190        }
8191    }
8192    pub fn member_blocked(&self) -> Option<SndGroupEventMemberBlockedRef<'_>> {
8193        if let Self::MemberBlocked {
8194            group_member_id,
8195            profile,
8196            blocked,
8197            ..
8198        } = self
8199        {
8200            Some(SndGroupEventMemberBlockedRef {
8201                group_member_id,
8202                profile,
8203                blocked,
8204            })
8205        } else {
8206            None
8207        }
8208    }
8209    pub fn user_role(&self) -> Option<&GroupMemberRole> {
8210        if let Self::UserRole { role, .. } = self {
8211            Some(role)
8212        } else {
8213            None
8214        }
8215    }
8216    pub fn member_deleted(&self) -> Option<SndGroupEventMemberDeletedRef<'_>> {
8217        if let Self::MemberDeleted {
8218            group_member_id,
8219            profile,
8220            ..
8221        } = self
8222        {
8223            Some(SndGroupEventMemberDeletedRef {
8224                group_member_id,
8225                profile,
8226            })
8227        } else {
8228            None
8229        }
8230    }
8231    pub fn is_user_left(&self) -> bool {
8232        matches!(self, Self::UserLeft)
8233    }
8234    pub fn group_updated(&self) -> Option<&GroupProfile> {
8235        if let Self::GroupUpdated { group_profile, .. } = self {
8236            Some(group_profile)
8237        } else {
8238            None
8239        }
8240    }
8241    pub fn member_accepted(&self) -> Option<SndGroupEventMemberAcceptedRef<'_>> {
8242        if let Self::MemberAccepted {
8243            group_member_id,
8244            profile,
8245            ..
8246        } = self
8247        {
8248            Some(SndGroupEventMemberAcceptedRef {
8249                group_member_id,
8250                profile,
8251            })
8252        } else {
8253            None
8254        }
8255    }
8256    pub fn is_user_pending_review(&self) -> bool {
8257        matches!(self, Self::UserPendingReview)
8258    }
8259}
8260#[derive(Clone, Copy)]
8261pub struct SndGroupEventMemberRoleRef<'a> {
8262    pub group_member_id: &'a i64,
8263    pub profile: &'a Profile,
8264    pub role: &'a GroupMemberRole,
8265}
8266#[derive(Clone, Copy)]
8267pub struct SndGroupEventMemberBlockedRef<'a> {
8268    pub group_member_id: &'a i64,
8269    pub profile: &'a Profile,
8270    pub blocked: &'a bool,
8271}
8272#[derive(Clone, Copy)]
8273pub struct SndGroupEventMemberDeletedRef<'a> {
8274    pub group_member_id: &'a i64,
8275    pub profile: &'a Profile,
8276}
8277#[derive(Clone, Copy)]
8278pub struct SndGroupEventMemberAcceptedRef<'a> {
8279    pub group_member_id: &'a i64,
8280    pub profile: &'a Profile,
8281}
8282
8283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8284#[serde(tag = "type")]
8285#[non_exhaustive]
8286pub enum SubscriptionStatus {
8287    #[serde(rename = "active")]
8288    Active,
8289    #[serde(rename = "pending")]
8290    Pending,
8291    #[serde(rename = "removed")]
8292    Removed {
8293        #[serde(rename = "subError")]
8294        sub_error: String,
8295
8296        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8297        undocumented: JsonObject,
8298    },
8299    #[serde(rename = "noSub")]
8300    NoSub,
8301    #[serde(untagged)]
8302    Undocumented(JsonObject),
8303}
8304
8305impl SubscriptionStatus {
8306    pub fn make_active() -> Self {
8307        Self::Active
8308    }
8309
8310    pub fn make_pending() -> Self {
8311        Self::Pending
8312    }
8313
8314    pub fn make_removed(sub_error: String) -> Self {
8315        Self::Removed {
8316            sub_error,
8317            undocumented: Default::default(),
8318        }
8319    }
8320
8321    pub fn make_no_sub() -> Self {
8322        Self::NoSub
8323    }
8324}
8325
8326impl SubscriptionStatus {
8327    pub fn is_active(&self) -> bool {
8328        matches!(self, Self::Active)
8329    }
8330    pub fn is_pending(&self) -> bool {
8331        matches!(self, Self::Pending)
8332    }
8333    pub fn removed(&self) -> Option<&String> {
8334        if let Self::Removed { sub_error, .. } = self {
8335            Some(sub_error)
8336        } else {
8337            None
8338        }
8339    }
8340    pub fn is_no_sub(&self) -> bool {
8341        matches!(self, Self::NoSub)
8342    }
8343}
8344
8345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8346#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8347#[cfg_attr(feature = "bon", builder(on(String, into)))]
8348pub struct SupportGroupPreference {
8349    #[serde(rename = "enable")]
8350    pub enable: GroupFeatureEnabled,
8351
8352    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8353    #[cfg_attr(feature = "bon", builder(default))]
8354    pub undocumented: JsonObject,
8355}
8356
8357#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
8358#[non_exhaustive]
8359pub enum SwitchPhase {
8360    #[default]
8361    #[serde(rename = "started")]
8362    Started,
8363    #[serde(rename = "confirmed")]
8364    Confirmed,
8365    #[serde(rename = "secured")]
8366    Secured,
8367    #[serde(rename = "completed")]
8368    Completed,
8369}
8370
8371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8372#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8373#[cfg_attr(feature = "bon", builder(on(String, into)))]
8374pub struct TimedMessagesGroupPreference {
8375    #[serde(rename = "enable")]
8376    pub enable: GroupFeatureEnabled,
8377
8378    #[serde(
8379        rename = "ttl",
8380        skip_serializing_if = "Option::is_none",
8381        deserialize_with = "deserialize_option_number_from_string",
8382        default
8383    )]
8384    pub ttl: Option<i32>,
8385
8386    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8387    #[cfg_attr(feature = "bon", builder(default))]
8388    pub undocumented: JsonObject,
8389}
8390
8391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8392#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8393#[cfg_attr(feature = "bon", builder(on(String, into)))]
8394pub struct TimedMessagesPreference {
8395    #[serde(rename = "allow")]
8396    pub allow: FeatureAllowed,
8397
8398    #[serde(
8399        rename = "ttl",
8400        skip_serializing_if = "Option::is_none",
8401        deserialize_with = "deserialize_option_number_from_string",
8402        default
8403    )]
8404    pub ttl: Option<i32>,
8405
8406    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8407    #[cfg_attr(feature = "bon", builder(default))]
8408    pub undocumented: JsonObject,
8409}
8410
8411#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
8412#[non_exhaustive]
8413pub enum UIColorMode {
8414    #[default]
8415    #[serde(rename = "light")]
8416    Light,
8417    #[serde(rename = "dark")]
8418    Dark,
8419}
8420
8421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8422#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8423#[cfg_attr(feature = "bon", builder(on(String, into)))]
8424pub struct UIColors {
8425    #[serde(rename = "accent", skip_serializing_if = "Option::is_none")]
8426    pub accent: Option<String>,
8427
8428    #[serde(rename = "accentVariant", skip_serializing_if = "Option::is_none")]
8429    pub accent_variant: Option<String>,
8430
8431    #[serde(rename = "secondary", skip_serializing_if = "Option::is_none")]
8432    pub secondary: Option<String>,
8433
8434    #[serde(rename = "secondaryVariant", skip_serializing_if = "Option::is_none")]
8435    pub secondary_variant: Option<String>,
8436
8437    #[serde(rename = "background", skip_serializing_if = "Option::is_none")]
8438    pub background: Option<String>,
8439
8440    #[serde(rename = "menus", skip_serializing_if = "Option::is_none")]
8441    pub menus: Option<String>,
8442
8443    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
8444    pub title: Option<String>,
8445
8446    #[serde(rename = "accentVariant2", skip_serializing_if = "Option::is_none")]
8447    pub accent_variant_2: Option<String>,
8448
8449    #[serde(rename = "sentMessage", skip_serializing_if = "Option::is_none")]
8450    pub sent_message: Option<String>,
8451
8452    #[serde(rename = "sentReply", skip_serializing_if = "Option::is_none")]
8453    pub sent_reply: Option<String>,
8454
8455    #[serde(rename = "receivedMessage", skip_serializing_if = "Option::is_none")]
8456    pub received_message: Option<String>,
8457
8458    #[serde(rename = "receivedReply", skip_serializing_if = "Option::is_none")]
8459    pub received_reply: Option<String>,
8460
8461    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8462    #[cfg_attr(feature = "bon", builder(default))]
8463    pub undocumented: JsonObject,
8464}
8465
8466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8467#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8468#[cfg_attr(feature = "bon", builder(on(String, into)))]
8469pub struct UIThemeEntityOverride {
8470    #[serde(rename = "mode")]
8471    pub mode: UIColorMode,
8472
8473    #[serde(rename = "wallpaper", skip_serializing_if = "Option::is_none")]
8474    pub wallpaper: Option<ChatWallpaper>,
8475
8476    #[serde(rename = "colors")]
8477    pub colors: UIColors,
8478
8479    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8480    #[cfg_attr(feature = "bon", builder(default))]
8481    pub undocumented: JsonObject,
8482}
8483
8484#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8485#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8486#[cfg_attr(feature = "bon", builder(on(String, into)))]
8487pub struct UIThemeEntityOverrides {
8488    #[serde(rename = "light", skip_serializing_if = "Option::is_none")]
8489    pub light: Option<UIThemeEntityOverride>,
8490
8491    #[serde(rename = "dark", skip_serializing_if = "Option::is_none")]
8492    pub dark: Option<UIThemeEntityOverride>,
8493
8494    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8495    #[cfg_attr(feature = "bon", builder(default))]
8496    pub undocumented: JsonObject,
8497}
8498
8499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8500#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8501#[cfg_attr(feature = "bon", builder(on(String, into)))]
8502pub struct UpdatedMessage {
8503    #[serde(rename = "msgContent")]
8504    pub msg_content: MsgContent,
8505
8506    #[serde(rename = "mentions")]
8507    pub mentions: BTreeMap<String, i64>,
8508
8509    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8510    #[cfg_attr(feature = "bon", builder(default))]
8511    pub undocumented: JsonObject,
8512}
8513
8514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8515#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8516#[cfg_attr(feature = "bon", builder(on(String, into)))]
8517pub struct User {
8518    #[serde(rename = "userId", deserialize_with = "deserialize_number_from_string")]
8519    pub user_id: i64,
8520
8521    #[serde(
8522        rename = "agentUserId",
8523        deserialize_with = "deserialize_number_from_string"
8524    )]
8525    pub agent_user_id: i64,
8526
8527    #[serde(
8528        rename = "userContactId",
8529        deserialize_with = "deserialize_number_from_string"
8530    )]
8531    pub user_contact_id: i64,
8532
8533    #[serde(rename = "localDisplayName")]
8534    pub local_display_name: String,
8535
8536    #[serde(rename = "profile")]
8537    pub profile: LocalProfile,
8538
8539    #[serde(rename = "fullPreferences")]
8540    pub full_preferences: FullPreferences,
8541
8542    #[serde(rename = "activeUser", default)]
8543    pub active_user: bool,
8544
8545    #[serde(
8546        rename = "activeOrder",
8547        deserialize_with = "deserialize_number_from_string"
8548    )]
8549    pub active_order: i64,
8550
8551    #[serde(rename = "viewPwdHash", skip_serializing_if = "Option::is_none")]
8552    pub view_pwd_hash: Option<UserPwdHash>,
8553
8554    #[serde(rename = "showNtfs", default)]
8555    pub show_ntfs: bool,
8556
8557    #[serde(rename = "sendRcptsContacts", default)]
8558    pub send_rcpts_contacts: bool,
8559
8560    #[serde(rename = "sendRcptsSmallGroups", default)]
8561    pub send_rcpts_small_groups: bool,
8562
8563    #[serde(rename = "autoAcceptMemberContacts", default)]
8564    pub auto_accept_member_contacts: bool,
8565
8566    #[serde(
8567        rename = "userMemberProfileUpdatedAt",
8568        skip_serializing_if = "Option::is_none"
8569    )]
8570    pub user_member_profile_updated_at: Option<UtcTime>,
8571
8572    #[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
8573    pub ui_themes: Option<UIThemeEntityOverrides>,
8574
8575    #[serde(rename = "userChatRelay", default)]
8576    pub user_chat_relay: bool,
8577
8578    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8579    #[cfg_attr(feature = "bon", builder(default))]
8580    pub undocumented: JsonObject,
8581}
8582
8583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8584#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8585#[cfg_attr(feature = "bon", builder(on(String, into)))]
8586pub struct UserChatRelay {
8587    #[serde(
8588        rename = "chatRelayId",
8589        deserialize_with = "deserialize_number_from_string"
8590    )]
8591    pub chat_relay_id: i64,
8592
8593    #[serde(rename = "address")]
8594    pub address: String,
8595
8596    #[serde(rename = "relayProfile")]
8597    pub relay_profile: RelayProfile,
8598
8599    #[serde(rename = "domains")]
8600    pub domains: Vec<String>,
8601
8602    #[serde(rename = "preset", default)]
8603    pub preset: bool,
8604
8605    #[serde(rename = "tested", skip_serializing_if = "Option::is_none")]
8606    pub tested: Option<bool>,
8607
8608    #[serde(rename = "enabled", default)]
8609    pub enabled: bool,
8610
8611    #[serde(rename = "deleted", default)]
8612    pub deleted: bool,
8613
8614    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8615    #[cfg_attr(feature = "bon", builder(default))]
8616    pub undocumented: JsonObject,
8617}
8618
8619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8620#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8621#[cfg_attr(feature = "bon", builder(on(String, into)))]
8622pub struct UserContact {
8623    #[serde(
8624        rename = "userContactLinkId",
8625        deserialize_with = "deserialize_number_from_string"
8626    )]
8627    pub user_contact_link_id: i64,
8628
8629    #[serde(rename = "connReqContact")]
8630    pub conn_req_contact: String,
8631
8632    #[serde(
8633        rename = "groupId",
8634        skip_serializing_if = "Option::is_none",
8635        deserialize_with = "deserialize_option_number_from_string",
8636        default
8637    )]
8638    pub group_id: Option<i64>,
8639
8640    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8641    #[cfg_attr(feature = "bon", builder(default))]
8642    pub undocumented: JsonObject,
8643}
8644
8645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8646#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8647#[cfg_attr(feature = "bon", builder(on(String, into)))]
8648pub struct UserContactLink {
8649    #[serde(
8650        rename = "userContactLinkId",
8651        deserialize_with = "deserialize_number_from_string"
8652    )]
8653    pub user_contact_link_id: i64,
8654
8655    #[serde(rename = "connLinkContact")]
8656    pub conn_link_contact: CreatedConnLink,
8657
8658    #[serde(rename = "shortLinkDataSet", default)]
8659    pub short_link_data_set: bool,
8660
8661    #[serde(rename = "shortLinkLargeDataSet", default)]
8662    pub short_link_large_data_set: bool,
8663
8664    #[serde(rename = "addressSettings")]
8665    pub address_settings: AddressSettings,
8666
8667    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8668    #[cfg_attr(feature = "bon", builder(default))]
8669    pub undocumented: JsonObject,
8670}
8671
8672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8673#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8674#[cfg_attr(feature = "bon", builder(on(String, into)))]
8675pub struct UserContactRequest {
8676    #[serde(
8677        rename = "contactRequestId",
8678        deserialize_with = "deserialize_number_from_string"
8679    )]
8680    pub contact_request_id: i64,
8681
8682    #[serde(rename = "agentInvitationId")]
8683    pub agent_invitation_id: String,
8684
8685    #[serde(
8686        rename = "contactId_",
8687        skip_serializing_if = "Option::is_none",
8688        deserialize_with = "deserialize_option_number_from_string",
8689        default
8690    )]
8691    pub contact_id: Option<i64>,
8692
8693    #[serde(
8694        rename = "businessGroupId_",
8695        skip_serializing_if = "Option::is_none",
8696        deserialize_with = "deserialize_option_number_from_string",
8697        default
8698    )]
8699    pub business_group_id: Option<i64>,
8700
8701    #[serde(
8702        rename = "userContactLinkId_",
8703        skip_serializing_if = "Option::is_none",
8704        deserialize_with = "deserialize_option_number_from_string",
8705        default
8706    )]
8707    pub user_contact_link_id: Option<i64>,
8708
8709    #[serde(rename = "cReqChatVRange")]
8710    pub c_req_chat_v_range: VersionRange,
8711
8712    #[serde(rename = "localDisplayName")]
8713    pub local_display_name: String,
8714
8715    #[serde(
8716        rename = "profileId",
8717        deserialize_with = "deserialize_number_from_string"
8718    )]
8719    pub profile_id: i64,
8720
8721    #[serde(rename = "profile")]
8722    pub profile: Profile,
8723
8724    #[serde(rename = "createdAt")]
8725    pub created_at: UtcTime,
8726
8727    #[serde(rename = "updatedAt")]
8728    pub updated_at: UtcTime,
8729
8730    #[serde(rename = "xContactId", skip_serializing_if = "Option::is_none")]
8731    pub x_contact_id: Option<String>,
8732
8733    #[serde(rename = "pqSupport", default)]
8734    pub pq_support: bool,
8735
8736    #[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
8737    pub welcome_shared_msg_id: Option<String>,
8738
8739    #[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
8740    pub request_shared_msg_id: Option<String>,
8741
8742    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8743    #[cfg_attr(feature = "bon", builder(default))]
8744    pub undocumented: JsonObject,
8745}
8746
8747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8748#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8749#[cfg_attr(feature = "bon", builder(on(String, into)))]
8750pub struct UserInfo {
8751    #[serde(rename = "user")]
8752    pub user: User,
8753
8754    #[serde(
8755        rename = "unreadCount",
8756        deserialize_with = "deserialize_number_from_string"
8757    )]
8758    pub unread_count: i32,
8759
8760    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8761    #[cfg_attr(feature = "bon", builder(default))]
8762    pub undocumented: JsonObject,
8763}
8764
8765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8766#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8767#[cfg_attr(feature = "bon", builder(on(String, into)))]
8768pub struct UserProfileUpdateSummary {
8769    #[serde(
8770        rename = "updateSuccesses",
8771        deserialize_with = "deserialize_number_from_string"
8772    )]
8773    pub update_successes: i32,
8774
8775    #[serde(
8776        rename = "updateFailures",
8777        deserialize_with = "deserialize_number_from_string"
8778    )]
8779    pub update_failures: i32,
8780
8781    #[serde(rename = "changedContacts")]
8782    pub changed_contacts: Vec<Contact>,
8783
8784    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8785    #[cfg_attr(feature = "bon", builder(default))]
8786    pub undocumented: JsonObject,
8787}
8788
8789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8790#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8791#[cfg_attr(feature = "bon", builder(on(String, into)))]
8792pub struct UserPwdHash {
8793    #[serde(rename = "hash")]
8794    pub hash: String,
8795
8796    #[serde(rename = "salt")]
8797    pub salt: String,
8798
8799    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8800    #[cfg_attr(feature = "bon", builder(default))]
8801    pub undocumented: JsonObject,
8802}
8803
8804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8805#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8806#[cfg_attr(feature = "bon", builder(on(String, into)))]
8807pub struct VersionRange {
8808    #[serde(
8809        rename = "minVersion",
8810        deserialize_with = "deserialize_number_from_string"
8811    )]
8812    pub min_version: i32,
8813
8814    #[serde(
8815        rename = "maxVersion",
8816        deserialize_with = "deserialize_number_from_string"
8817    )]
8818    pub max_version: i32,
8819
8820    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8821    #[cfg_attr(feature = "bon", builder(default))]
8822    pub undocumented: JsonObject,
8823}
8824
8825#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8826#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8827#[cfg_attr(feature = "bon", builder(on(String, into)))]
8828pub struct XFTPRcvFile {
8829    #[serde(rename = "rcvFileDescription")]
8830    pub rcv_file_description: RcvFileDescr,
8831
8832    #[serde(rename = "agentRcvFileId", skip_serializing_if = "Option::is_none")]
8833    pub agent_rcv_file_id: Option<String>,
8834
8835    #[serde(rename = "agentRcvFileDeleted", default)]
8836    pub agent_rcv_file_deleted: bool,
8837
8838    #[serde(rename = "userApprovedRelays", default)]
8839    pub user_approved_relays: bool,
8840
8841    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8842    #[cfg_attr(feature = "bon", builder(default))]
8843    pub undocumented: JsonObject,
8844}
8845
8846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8847#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8848#[cfg_attr(feature = "bon", builder(on(String, into)))]
8849pub struct XFTPSndFile {
8850    #[serde(rename = "agentSndFileId")]
8851    pub agent_snd_file_id: String,
8852
8853    #[serde(
8854        rename = "privateSndFileDescr",
8855        skip_serializing_if = "Option::is_none"
8856    )]
8857    pub private_snd_file_descr: Option<String>,
8858
8859    #[serde(rename = "agentSndFileDeleted", default)]
8860    pub agent_snd_file_deleted: bool,
8861
8862    #[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
8863    pub crypto_args: Option<CryptoFileArgs>,
8864
8865    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8866    #[cfg_attr(feature = "bon", builder(default))]
8867    pub undocumented: JsonObject,
8868}