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 = "command")]
4204    Command {
4205        #[serde(rename = "commandStr")]
4206        command_str: String,
4207
4208        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4209        undocumented: JsonObject,
4210    },
4211    #[serde(rename = "mention")]
4212    Mention {
4213        #[serde(rename = "memberName")]
4214        member_name: String,
4215
4216        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4217        undocumented: JsonObject,
4218    },
4219    #[serde(rename = "email")]
4220    Email,
4221    #[serde(rename = "phone")]
4222    Phone,
4223    #[serde(untagged)]
4224    Undocumented(JsonObject),
4225}
4226
4227impl Format {
4228    pub fn make_bold() -> Self {
4229        Self::Bold
4230    }
4231
4232    pub fn make_italic() -> Self {
4233        Self::Italic
4234    }
4235
4236    pub fn make_strike_through() -> Self {
4237        Self::StrikeThrough
4238    }
4239
4240    pub fn make_snippet() -> Self {
4241        Self::Snippet
4242    }
4243
4244    pub fn make_secret() -> Self {
4245        Self::Secret
4246    }
4247
4248    pub fn make_small() -> Self {
4249        Self::Small
4250    }
4251
4252    pub fn make_colored(color: Color) -> Self {
4253        Self::Colored {
4254            color,
4255            undocumented: Default::default(),
4256        }
4257    }
4258
4259    pub fn make_uri() -> Self {
4260        Self::Uri
4261    }
4262
4263    pub fn make_hyper_link(show_text: Option<String>, link_uri: String) -> Self {
4264        Self::HyperLink {
4265            show_text,
4266            link_uri,
4267            undocumented: Default::default(),
4268        }
4269    }
4270
4271    pub fn make_simplex_link(
4272        show_text: Option<String>,
4273        link_type: SimplexLinkType,
4274        simplex_uri: String,
4275        smp_hosts: Vec<String>,
4276    ) -> Self {
4277        Self::SimplexLink {
4278            show_text,
4279            link_type,
4280            simplex_uri,
4281            smp_hosts,
4282            undocumented: Default::default(),
4283        }
4284    }
4285
4286    pub fn make_command(command_str: String) -> Self {
4287        Self::Command {
4288            command_str,
4289            undocumented: Default::default(),
4290        }
4291    }
4292
4293    pub fn make_mention(member_name: String) -> Self {
4294        Self::Mention {
4295            member_name,
4296            undocumented: Default::default(),
4297        }
4298    }
4299
4300    pub fn make_email() -> Self {
4301        Self::Email
4302    }
4303
4304    pub fn make_phone() -> Self {
4305        Self::Phone
4306    }
4307}
4308
4309impl Format {
4310    pub fn is_bold(&self) -> bool {
4311        matches!(self, Self::Bold)
4312    }
4313    pub fn is_italic(&self) -> bool {
4314        matches!(self, Self::Italic)
4315    }
4316    pub fn is_strike_through(&self) -> bool {
4317        matches!(self, Self::StrikeThrough)
4318    }
4319    pub fn is_snippet(&self) -> bool {
4320        matches!(self, Self::Snippet)
4321    }
4322    pub fn is_secret(&self) -> bool {
4323        matches!(self, Self::Secret)
4324    }
4325    pub fn is_small(&self) -> bool {
4326        matches!(self, Self::Small)
4327    }
4328    pub fn colored(&self) -> Option<&Color> {
4329        if let Self::Colored { color, .. } = self {
4330            Some(color)
4331        } else {
4332            None
4333        }
4334    }
4335    pub fn is_uri(&self) -> bool {
4336        matches!(self, Self::Uri)
4337    }
4338    pub fn hyper_link(&self) -> Option<FormatHyperLinkRef<'_>> {
4339        if let Self::HyperLink {
4340            show_text,
4341            link_uri,
4342            ..
4343        } = self
4344        {
4345            Some(FormatHyperLinkRef {
4346                show_text,
4347                link_uri,
4348            })
4349        } else {
4350            None
4351        }
4352    }
4353    pub fn simplex_link(&self) -> Option<FormatSimplexLinkRef<'_>> {
4354        if let Self::SimplexLink {
4355            show_text,
4356            link_type,
4357            simplex_uri,
4358            smp_hosts,
4359            ..
4360        } = self
4361        {
4362            Some(FormatSimplexLinkRef {
4363                show_text,
4364                link_type,
4365                simplex_uri,
4366                smp_hosts,
4367            })
4368        } else {
4369            None
4370        }
4371    }
4372    pub fn command(&self) -> Option<&String> {
4373        if let Self::Command { command_str, .. } = self {
4374            Some(command_str)
4375        } else {
4376            None
4377        }
4378    }
4379    pub fn mention(&self) -> Option<&String> {
4380        if let Self::Mention { member_name, .. } = self {
4381            Some(member_name)
4382        } else {
4383            None
4384        }
4385    }
4386    pub fn is_email(&self) -> bool {
4387        matches!(self, Self::Email)
4388    }
4389    pub fn is_phone(&self) -> bool {
4390        matches!(self, Self::Phone)
4391    }
4392}
4393#[derive(Clone, Copy)]
4394pub struct FormatHyperLinkRef<'a> {
4395    pub show_text: &'a Option<String>,
4396    pub link_uri: &'a String,
4397}
4398#[derive(Clone, Copy)]
4399pub struct FormatSimplexLinkRef<'a> {
4400    pub show_text: &'a Option<String>,
4401    pub link_type: &'a SimplexLinkType,
4402    pub simplex_uri: &'a String,
4403    pub smp_hosts: &'a Vec<String>,
4404}
4405
4406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4407#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4408#[cfg_attr(feature = "bon", builder(on(String, into)))]
4409pub struct FormattedText {
4410    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
4411    pub format: Option<Format>,
4412
4413    #[serde(rename = "text")]
4414    pub text: String,
4415
4416    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4417    #[cfg_attr(feature = "bon", builder(default))]
4418    pub undocumented: JsonObject,
4419}
4420
4421#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4422#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4423#[cfg_attr(feature = "bon", builder(on(String, into)))]
4424pub struct FullGroupPreferences {
4425    #[serde(rename = "timedMessages")]
4426    pub timed_messages: TimedMessagesGroupPreference,
4427
4428    #[serde(rename = "directMessages")]
4429    pub direct_messages: RoleGroupPreference,
4430
4431    #[serde(rename = "fullDelete")]
4432    pub full_delete: GroupPreference,
4433
4434    #[serde(rename = "reactions")]
4435    pub reactions: GroupPreference,
4436
4437    #[serde(rename = "voice")]
4438    pub voice: RoleGroupPreference,
4439
4440    #[serde(rename = "files")]
4441    pub files: RoleGroupPreference,
4442
4443    #[serde(rename = "simplexLinks")]
4444    pub simplex_links: RoleGroupPreference,
4445
4446    #[serde(rename = "reports")]
4447    pub reports: GroupPreference,
4448
4449    #[serde(rename = "history")]
4450    pub history: GroupPreference,
4451
4452    #[serde(rename = "support")]
4453    pub support: SupportGroupPreference,
4454
4455    #[serde(rename = "sessions")]
4456    pub sessions: RoleGroupPreference,
4457
4458    #[serde(rename = "comments")]
4459    pub comments: CommentsGroupPreference,
4460
4461    #[serde(rename = "commands")]
4462    pub commands: Vec<ChatBotCommand>,
4463
4464    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4465    #[cfg_attr(feature = "bon", builder(default))]
4466    pub undocumented: JsonObject,
4467}
4468
4469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4470#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4471#[cfg_attr(feature = "bon", builder(on(String, into)))]
4472pub struct FullPreferences {
4473    #[serde(rename = "timedMessages")]
4474    pub timed_messages: TimedMessagesPreference,
4475
4476    #[serde(rename = "fullDelete")]
4477    pub full_delete: SimplePreference,
4478
4479    #[serde(rename = "reactions")]
4480    pub reactions: SimplePreference,
4481
4482    #[serde(rename = "voice")]
4483    pub voice: SimplePreference,
4484
4485    #[serde(rename = "files")]
4486    pub files: SimplePreference,
4487
4488    #[serde(rename = "calls")]
4489    pub calls: SimplePreference,
4490
4491    #[serde(rename = "sessions")]
4492    pub sessions: SimplePreference,
4493
4494    #[serde(rename = "commands")]
4495    pub commands: Vec<ChatBotCommand>,
4496
4497    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4498    #[cfg_attr(feature = "bon", builder(default))]
4499    pub undocumented: JsonObject,
4500}
4501
4502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4503#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4504#[cfg_attr(feature = "bon", builder(on(String, into)))]
4505pub struct Group {
4506    #[serde(rename = "groupInfo")]
4507    pub group_info: GroupInfo,
4508
4509    #[serde(rename = "members")]
4510    pub members: Vec<GroupMember>,
4511
4512    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4513    #[cfg_attr(feature = "bon", builder(default))]
4514    pub undocumented: JsonObject,
4515}
4516
4517/// *Syntax:*
4518///
4519/// ```
4520/// (_support[:<groupMemberId_>])
4521/// ```
4522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4523#[serde(tag = "type")]
4524#[non_exhaustive]
4525pub enum GroupChatScope {
4526    #[serde(rename = "memberSupport")]
4527    MemberSupport {
4528        #[serde(
4529            rename = "groupMemberId_",
4530            skip_serializing_if = "Option::is_none",
4531            deserialize_with = "deserialize_option_number_from_string",
4532            default
4533        )]
4534        group_member_id: Option<i64>,
4535
4536        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4537        undocumented: JsonObject,
4538    },
4539    #[serde(untagged)]
4540    Undocumented(JsonObject),
4541}
4542
4543impl CommandSyntax for GroupChatScope {
4544    const COMMAND_BUF_SIZE: usize = 64;
4545
4546    fn append_command_syntax(&self, buf: &mut String) {
4547        buf.push_str("(_support");
4548        match self {
4549            Self::MemberSupport {
4550                group_member_id, ..
4551            } => {
4552                if let Some(group_member_id) = group_member_id {
4553                    buf.push(':');
4554                    write!(buf, "{}", group_member_id).unwrap();
4555                }
4556            }
4557            Self::Undocumented(_) => {}
4558        }
4559        buf.push(')');
4560    }
4561}
4562
4563impl GroupChatScope {
4564    pub fn make_member_support(group_member_id: Option<i64>) -> Self {
4565        Self::MemberSupport {
4566            group_member_id,
4567            undocumented: Default::default(),
4568        }
4569    }
4570}
4571
4572impl GroupChatScope {
4573    pub fn member_support(&self) -> Option<&Option<i64>> {
4574        if let Self::MemberSupport {
4575            group_member_id, ..
4576        } = self
4577        {
4578            Some(group_member_id)
4579        } else {
4580            None
4581        }
4582    }
4583}
4584
4585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4586#[serde(tag = "type")]
4587#[non_exhaustive]
4588pub enum GroupChatScopeInfo {
4589    #[serde(rename = "memberSupport")]
4590    MemberSupport {
4591        #[serde(rename = "groupMember_", skip_serializing_if = "Option::is_none")]
4592        group_member: Option<GroupMember>,
4593
4594        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4595        undocumented: JsonObject,
4596    },
4597    #[serde(untagged)]
4598    Undocumented(JsonObject),
4599}
4600
4601impl GroupChatScopeInfo {
4602    pub fn make_member_support(group_member: Option<GroupMember>) -> Self {
4603        Self::MemberSupport {
4604            group_member,
4605            undocumented: Default::default(),
4606        }
4607    }
4608}
4609
4610impl GroupChatScopeInfo {
4611    pub fn member_support(&self) -> Option<&Option<GroupMember>> {
4612        if let Self::MemberSupport { group_member, .. } = self {
4613            Some(group_member)
4614        } else {
4615            None
4616        }
4617    }
4618}
4619
4620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4621#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4622#[cfg_attr(feature = "bon", builder(on(String, into)))]
4623pub struct GroupDirectInvitation {
4624    #[serde(rename = "groupDirectInvLink")]
4625    pub group_direct_inv_link: String,
4626
4627    #[serde(
4628        rename = "fromGroupId_",
4629        skip_serializing_if = "Option::is_none",
4630        deserialize_with = "deserialize_option_number_from_string",
4631        default
4632    )]
4633    pub from_group_id: Option<i64>,
4634
4635    #[serde(
4636        rename = "fromGroupMemberId_",
4637        skip_serializing_if = "Option::is_none",
4638        deserialize_with = "deserialize_option_number_from_string",
4639        default
4640    )]
4641    pub from_group_member_id: Option<i64>,
4642
4643    #[serde(
4644        rename = "fromGroupMemberConnId_",
4645        skip_serializing_if = "Option::is_none",
4646        deserialize_with = "deserialize_option_number_from_string",
4647        default
4648    )]
4649    pub from_group_member_conn_id: Option<i64>,
4650
4651    #[serde(rename = "groupDirectInvStartedConnection", default)]
4652    pub group_direct_inv_started_connection: bool,
4653
4654    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4655    #[cfg_attr(feature = "bon", builder(default))]
4656    pub undocumented: JsonObject,
4657}
4658
4659#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4660#[non_exhaustive]
4661pub enum GroupFeature {
4662    #[default]
4663    #[serde(rename = "timedMessages")]
4664    TimedMessages,
4665    #[serde(rename = "directMessages")]
4666    DirectMessages,
4667    #[serde(rename = "fullDelete")]
4668    FullDelete,
4669    #[serde(rename = "reactions")]
4670    Reactions,
4671    #[serde(rename = "voice")]
4672    Voice,
4673    #[serde(rename = "files")]
4674    Files,
4675    #[serde(rename = "simplexLinks")]
4676    SimplexLinks,
4677    #[serde(rename = "reports")]
4678    Reports,
4679    #[serde(rename = "history")]
4680    History,
4681    #[serde(rename = "support")]
4682    Support,
4683    #[serde(rename = "sessions")]
4684    Sessions,
4685    #[serde(rename = "comments")]
4686    Comments,
4687}
4688
4689#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4690#[non_exhaustive]
4691pub enum GroupFeatureEnabled {
4692    #[default]
4693    #[serde(rename = "on")]
4694    On,
4695    #[serde(rename = "off")]
4696    Off,
4697}
4698
4699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4700#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4701#[cfg_attr(feature = "bon", builder(on(String, into)))]
4702pub struct GroupInfo {
4703    #[serde(
4704        rename = "groupId",
4705        deserialize_with = "deserialize_number_from_string"
4706    )]
4707    pub group_id: i64,
4708
4709    #[serde(rename = "useRelays", default)]
4710    pub use_relays: bool,
4711
4712    #[serde(rename = "relayOwnStatus", skip_serializing_if = "Option::is_none")]
4713    pub relay_own_status: Option<RelayStatus>,
4714
4715    #[serde(rename = "localDisplayName")]
4716    pub local_display_name: String,
4717
4718    #[serde(rename = "groupProfile")]
4719    pub group_profile: GroupProfile,
4720
4721    #[serde(rename = "localAlias")]
4722    pub local_alias: String,
4723
4724    #[serde(rename = "businessChat", skip_serializing_if = "Option::is_none")]
4725    pub business_chat: Option<BusinessChatInfo>,
4726
4727    #[serde(rename = "fullGroupPreferences")]
4728    pub full_group_preferences: FullGroupPreferences,
4729
4730    #[serde(rename = "membership")]
4731    pub membership: GroupMember,
4732
4733    #[serde(rename = "chatSettings")]
4734    pub chat_settings: ChatSettings,
4735
4736    #[serde(rename = "createdAt")]
4737    pub created_at: UtcTime,
4738
4739    #[serde(rename = "updatedAt")]
4740    pub updated_at: UtcTime,
4741
4742    #[serde(rename = "chatTs", skip_serializing_if = "Option::is_none")]
4743    pub chat_ts: Option<UtcTime>,
4744
4745    #[serde(
4746        rename = "userMemberProfileSentAt",
4747        skip_serializing_if = "Option::is_none"
4748    )]
4749    pub user_member_profile_sent_at: Option<UtcTime>,
4750
4751    #[serde(rename = "preparedGroup", skip_serializing_if = "Option::is_none")]
4752    pub prepared_group: Option<PreparedGroup>,
4753
4754    #[serde(rename = "chatTags")]
4755    pub chat_tags: Vec<i64>,
4756
4757    #[serde(
4758        rename = "chatItemTTL",
4759        skip_serializing_if = "Option::is_none",
4760        deserialize_with = "deserialize_option_number_from_string",
4761        default
4762    )]
4763    pub chat_item_ttl: Option<i64>,
4764
4765    #[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
4766    pub ui_themes: Option<UIThemeEntityOverrides>,
4767
4768    #[serde(rename = "customData", skip_serializing_if = "Option::is_none")]
4769    pub custom_data: Option<JsonObject>,
4770
4771    #[serde(rename = "groupSummary")]
4772    pub group_summary: GroupSummary,
4773
4774    #[serde(
4775        rename = "membersRequireAttention",
4776        deserialize_with = "deserialize_number_from_string"
4777    )]
4778    pub members_require_attention: i32,
4779
4780    #[serde(rename = "viaGroupLinkUri", skip_serializing_if = "Option::is_none")]
4781    pub via_group_link_uri: Option<String>,
4782
4783    #[serde(rename = "groupKeys", skip_serializing_if = "Option::is_none")]
4784    pub group_keys: Option<GroupKeys>,
4785
4786    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4787    #[cfg_attr(feature = "bon", builder(default))]
4788    pub undocumented: JsonObject,
4789}
4790
4791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4792#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4793#[cfg_attr(feature = "bon", builder(on(String, into)))]
4794pub struct GroupKeys {
4795    #[serde(rename = "publicGroupId")]
4796    pub public_group_id: String,
4797
4798    #[serde(rename = "groupRootKey")]
4799    pub group_root_key: GroupRootKey,
4800
4801    #[serde(rename = "memberPrivKey")]
4802    pub member_priv_key: String,
4803
4804    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4805    #[cfg_attr(feature = "bon", builder(default))]
4806    pub undocumented: JsonObject,
4807}
4808
4809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4810#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4811#[cfg_attr(feature = "bon", builder(on(String, into)))]
4812pub struct GroupLink {
4813    #[serde(
4814        rename = "userContactLinkId",
4815        deserialize_with = "deserialize_number_from_string"
4816    )]
4817    pub user_contact_link_id: i64,
4818
4819    #[serde(rename = "connLinkContact")]
4820    pub conn_link_contact: CreatedConnLink,
4821
4822    #[serde(rename = "shortLinkDataSet", default)]
4823    pub short_link_data_set: bool,
4824
4825    #[serde(rename = "shortLinkLargeDataSet", default)]
4826    pub short_link_large_data_set: bool,
4827
4828    #[serde(rename = "groupLinkId")]
4829    pub group_link_id: String,
4830
4831    #[serde(rename = "acceptMemberRole")]
4832    pub accept_member_role: GroupMemberRole,
4833
4834    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4835    #[cfg_attr(feature = "bon", builder(default))]
4836    pub undocumented: JsonObject,
4837}
4838
4839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4840#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4841#[cfg_attr(feature = "bon", builder(on(String, into)))]
4842pub struct GroupLinkOwner {
4843    #[serde(rename = "memberId")]
4844    pub member_id: String,
4845
4846    #[serde(rename = "memberKey")]
4847    pub member_key: String,
4848
4849    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4850    #[cfg_attr(feature = "bon", builder(default))]
4851    pub undocumented: JsonObject,
4852}
4853
4854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4855#[serde(tag = "type")]
4856#[non_exhaustive]
4857pub enum GroupLinkPlan {
4858    #[serde(rename = "ok")]
4859    Ok {
4860        #[serde(rename = "groupSLinkInfo_", skip_serializing_if = "Option::is_none")]
4861        group_s_link_info: Option<GroupShortLinkInfo>,
4862
4863        #[serde(rename = "groupSLinkData_", skip_serializing_if = "Option::is_none")]
4864        group_s_link_data: Option<GroupShortLinkData>,
4865
4866        #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
4867        owner_verification: Option<OwnerVerification>,
4868
4869        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4870        undocumented: JsonObject,
4871    },
4872    #[serde(rename = "ownLink")]
4873    OwnLink {
4874        #[serde(rename = "groupInfo")]
4875        group_info: GroupInfo,
4876
4877        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4878        undocumented: JsonObject,
4879    },
4880    #[serde(rename = "connectingConfirmReconnect")]
4881    ConnectingConfirmReconnect,
4882    #[serde(rename = "connectingProhibit")]
4883    ConnectingProhibit {
4884        #[serde(rename = "groupInfo_", skip_serializing_if = "Option::is_none")]
4885        group_info: Option<GroupInfo>,
4886
4887        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4888        undocumented: JsonObject,
4889    },
4890    #[serde(rename = "known")]
4891    Known {
4892        #[serde(rename = "groupInfo")]
4893        group_info: GroupInfo,
4894
4895        #[serde(rename = "groupUpdated", default)]
4896        group_updated: bool,
4897
4898        #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
4899        owner_verification: Option<OwnerVerification>,
4900
4901        #[serde(rename = "linkOwners")]
4902        link_owners: Vec<GroupLinkOwner>,
4903
4904        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4905        undocumented: JsonObject,
4906    },
4907    #[serde(rename = "noRelays")]
4908    NoRelays {
4909        #[serde(rename = "groupSLinkData_", skip_serializing_if = "Option::is_none")]
4910        group_s_link_data: Option<GroupShortLinkData>,
4911
4912        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4913        undocumented: JsonObject,
4914    },
4915    #[serde(untagged)]
4916    Undocumented(JsonObject),
4917}
4918
4919impl GroupLinkPlan {
4920    pub fn make_ok(
4921        group_s_link_info: Option<GroupShortLinkInfo>,
4922        group_s_link_data: Option<GroupShortLinkData>,
4923        owner_verification: Option<OwnerVerification>,
4924    ) -> Self {
4925        Self::Ok {
4926            group_s_link_info,
4927            group_s_link_data,
4928            owner_verification,
4929            undocumented: Default::default(),
4930        }
4931    }
4932
4933    pub fn make_own_link(group_info: GroupInfo) -> Self {
4934        Self::OwnLink {
4935            group_info,
4936            undocumented: Default::default(),
4937        }
4938    }
4939
4940    pub fn make_connecting_confirm_reconnect() -> Self {
4941        Self::ConnectingConfirmReconnect
4942    }
4943
4944    pub fn make_connecting_prohibit(group_info: Option<GroupInfo>) -> Self {
4945        Self::ConnectingProhibit {
4946            group_info,
4947            undocumented: Default::default(),
4948        }
4949    }
4950
4951    pub fn make_known(
4952        group_info: GroupInfo,
4953        group_updated: bool,
4954        owner_verification: Option<OwnerVerification>,
4955        link_owners: Vec<GroupLinkOwner>,
4956    ) -> Self {
4957        Self::Known {
4958            group_info,
4959            group_updated,
4960            owner_verification,
4961            link_owners,
4962            undocumented: Default::default(),
4963        }
4964    }
4965
4966    pub fn make_no_relays(group_s_link_data: Option<GroupShortLinkData>) -> Self {
4967        Self::NoRelays {
4968            group_s_link_data,
4969            undocumented: Default::default(),
4970        }
4971    }
4972}
4973
4974impl GroupLinkPlan {
4975    pub fn ok(&self) -> Option<GroupLinkPlanOkRef<'_>> {
4976        if let Self::Ok {
4977            group_s_link_info,
4978            group_s_link_data,
4979            owner_verification,
4980            ..
4981        } = self
4982        {
4983            Some(GroupLinkPlanOkRef {
4984                group_s_link_info,
4985                group_s_link_data,
4986                owner_verification,
4987            })
4988        } else {
4989            None
4990        }
4991    }
4992    pub fn own_link(&self) -> Option<&GroupInfo> {
4993        if let Self::OwnLink { group_info, .. } = self {
4994            Some(group_info)
4995        } else {
4996            None
4997        }
4998    }
4999    pub fn is_connecting_confirm_reconnect(&self) -> bool {
5000        matches!(self, Self::ConnectingConfirmReconnect)
5001    }
5002    pub fn connecting_prohibit(&self) -> Option<&Option<GroupInfo>> {
5003        if let Self::ConnectingProhibit { group_info, .. } = self {
5004            Some(group_info)
5005        } else {
5006            None
5007        }
5008    }
5009    pub fn known(&self) -> Option<GroupLinkPlanKnownRef<'_>> {
5010        if let Self::Known {
5011            group_info,
5012            group_updated,
5013            owner_verification,
5014            link_owners,
5015            ..
5016        } = self
5017        {
5018            Some(GroupLinkPlanKnownRef {
5019                group_info,
5020                group_updated,
5021                owner_verification,
5022                link_owners,
5023            })
5024        } else {
5025            None
5026        }
5027    }
5028    pub fn no_relays(&self) -> Option<&Option<GroupShortLinkData>> {
5029        if let Self::NoRelays {
5030            group_s_link_data, ..
5031        } = self
5032        {
5033            Some(group_s_link_data)
5034        } else {
5035            None
5036        }
5037    }
5038}
5039#[derive(Clone, Copy)]
5040pub struct GroupLinkPlanOkRef<'a> {
5041    pub group_s_link_info: &'a Option<GroupShortLinkInfo>,
5042    pub group_s_link_data: &'a Option<GroupShortLinkData>,
5043    pub owner_verification: &'a Option<OwnerVerification>,
5044}
5045#[derive(Clone, Copy)]
5046pub struct GroupLinkPlanKnownRef<'a> {
5047    pub group_info: &'a GroupInfo,
5048    pub group_updated: &'a bool,
5049    pub owner_verification: &'a Option<OwnerVerification>,
5050    pub link_owners: &'a Vec<GroupLinkOwner>,
5051}
5052
5053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5054#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5055#[cfg_attr(feature = "bon", builder(on(String, into)))]
5056pub struct GroupMember {
5057    #[serde(
5058        rename = "groupMemberId",
5059        deserialize_with = "deserialize_number_from_string"
5060    )]
5061    pub group_member_id: i64,
5062
5063    #[serde(
5064        rename = "groupId",
5065        deserialize_with = "deserialize_number_from_string"
5066    )]
5067    pub group_id: i64,
5068
5069    #[serde(
5070        rename = "indexInGroup",
5071        deserialize_with = "deserialize_number_from_string"
5072    )]
5073    pub index_in_group: i64,
5074
5075    #[serde(rename = "memberId")]
5076    pub member_id: String,
5077
5078    #[serde(rename = "memberRole")]
5079    pub member_role: GroupMemberRole,
5080
5081    #[serde(rename = "memberCategory")]
5082    pub member_category: GroupMemberCategory,
5083
5084    #[serde(rename = "memberStatus")]
5085    pub member_status: GroupMemberStatus,
5086
5087    #[serde(rename = "memberSettings")]
5088    pub member_settings: GroupMemberSettings,
5089
5090    #[serde(rename = "blockedByAdmin", default)]
5091    pub blocked_by_admin: bool,
5092
5093    #[serde(rename = "invitedBy")]
5094    pub invited_by: InvitedBy,
5095
5096    #[serde(
5097        rename = "invitedByGroupMemberId",
5098        skip_serializing_if = "Option::is_none",
5099        deserialize_with = "deserialize_option_number_from_string",
5100        default
5101    )]
5102    pub invited_by_group_member_id: Option<i64>,
5103
5104    #[serde(rename = "localDisplayName")]
5105    pub local_display_name: String,
5106
5107    #[serde(rename = "memberProfile")]
5108    pub member_profile: LocalProfile,
5109
5110    #[serde(
5111        rename = "memberContactId",
5112        skip_serializing_if = "Option::is_none",
5113        deserialize_with = "deserialize_option_number_from_string",
5114        default
5115    )]
5116    pub member_contact_id: Option<i64>,
5117
5118    #[serde(
5119        rename = "memberContactProfileId",
5120        deserialize_with = "deserialize_number_from_string"
5121    )]
5122    pub member_contact_profile_id: i64,
5123
5124    #[serde(rename = "activeConn", skip_serializing_if = "Option::is_none")]
5125    pub active_conn: Option<Connection>,
5126
5127    #[serde(rename = "memberChatVRange")]
5128    pub member_chat_v_range: VersionRange,
5129
5130    #[serde(rename = "createdAt")]
5131    pub created_at: UtcTime,
5132
5133    #[serde(rename = "updatedAt")]
5134    pub updated_at: UtcTime,
5135
5136    #[serde(rename = "supportChat", skip_serializing_if = "Option::is_none")]
5137    pub support_chat: Option<GroupSupportChat>,
5138
5139    #[serde(rename = "memberPubKey", skip_serializing_if = "Option::is_none")]
5140    pub member_pub_key: Option<String>,
5141
5142    #[serde(rename = "relayLink", skip_serializing_if = "Option::is_none")]
5143    pub relay_link: Option<String>,
5144
5145    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5146    #[cfg_attr(feature = "bon", builder(default))]
5147    pub undocumented: JsonObject,
5148}
5149
5150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5151#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5152#[cfg_attr(feature = "bon", builder(on(String, into)))]
5153pub struct GroupMemberAdmission {
5154    #[serde(rename = "review", skip_serializing_if = "Option::is_none")]
5155    pub review: Option<MemberCriteria>,
5156
5157    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5158    #[cfg_attr(feature = "bon", builder(default))]
5159    pub undocumented: JsonObject,
5160}
5161
5162#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5163#[non_exhaustive]
5164pub enum GroupMemberCategory {
5165    #[default]
5166    #[serde(rename = "user")]
5167    User,
5168    #[serde(rename = "invitee")]
5169    Invitee,
5170    #[serde(rename = "host")]
5171    Host,
5172    #[serde(rename = "pre")]
5173    Pre,
5174    #[serde(rename = "post")]
5175    Post,
5176}
5177
5178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5179#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5180#[cfg_attr(feature = "bon", builder(on(String, into)))]
5181pub struct GroupMemberRef {
5182    #[serde(
5183        rename = "groupMemberId",
5184        deserialize_with = "deserialize_number_from_string"
5185    )]
5186    pub group_member_id: i64,
5187
5188    #[serde(rename = "profile")]
5189    pub profile: Profile,
5190
5191    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5192    #[cfg_attr(feature = "bon", builder(default))]
5193    pub undocumented: JsonObject,
5194}
5195
5196#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5197#[non_exhaustive]
5198pub enum GroupMemberRole {
5199    #[default]
5200    #[serde(rename = "relay")]
5201    Relay,
5202    #[serde(rename = "observer")]
5203    Observer,
5204    #[serde(rename = "author")]
5205    Author,
5206    #[serde(rename = "member")]
5207    Member,
5208    #[serde(rename = "moderator")]
5209    Moderator,
5210    #[serde(rename = "admin")]
5211    Admin,
5212    #[serde(rename = "owner")]
5213    Owner,
5214}
5215
5216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5217#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5218#[cfg_attr(feature = "bon", builder(on(String, into)))]
5219pub struct GroupMemberSettings {
5220    #[serde(rename = "showMessages", default)]
5221    pub show_messages: bool,
5222
5223    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5224    #[cfg_attr(feature = "bon", builder(default))]
5225    pub undocumented: JsonObject,
5226}
5227
5228#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5229#[non_exhaustive]
5230pub enum GroupMemberStatus {
5231    #[default]
5232    #[serde(rename = "rejected")]
5233    Rejected,
5234    #[serde(rename = "removed")]
5235    Removed,
5236    #[serde(rename = "left")]
5237    Left,
5238    #[serde(rename = "deleted")]
5239    Deleted,
5240    #[serde(rename = "unknown")]
5241    Unknown,
5242    #[serde(rename = "invited")]
5243    Invited,
5244    #[serde(rename = "pending_approval")]
5245    PendingApproval,
5246    #[serde(rename = "pending_review")]
5247    PendingReview,
5248    #[serde(rename = "introduced")]
5249    Introduced,
5250    #[serde(rename = "intro-inv")]
5251    IntroInv,
5252    #[serde(rename = "accepted")]
5253    Accepted,
5254    #[serde(rename = "announced")]
5255    Announced,
5256    #[serde(rename = "connected")]
5257    Connected,
5258    #[serde(rename = "complete")]
5259    Complete,
5260    #[serde(rename = "creator")]
5261    Creator,
5262}
5263
5264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5265#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5266#[cfg_attr(feature = "bon", builder(on(String, into)))]
5267pub struct GroupPreference {
5268    #[serde(rename = "enable")]
5269    pub enable: GroupFeatureEnabled,
5270
5271    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5272    #[cfg_attr(feature = "bon", builder(default))]
5273    pub undocumented: JsonObject,
5274}
5275
5276#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5277#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5278#[cfg_attr(feature = "bon", builder(on(String, into)))]
5279pub struct GroupPreferences {
5280    #[serde(rename = "timedMessages", skip_serializing_if = "Option::is_none")]
5281    pub timed_messages: Option<TimedMessagesGroupPreference>,
5282
5283    #[serde(rename = "directMessages", skip_serializing_if = "Option::is_none")]
5284    pub direct_messages: Option<RoleGroupPreference>,
5285
5286    #[serde(rename = "fullDelete", skip_serializing_if = "Option::is_none")]
5287    pub full_delete: Option<GroupPreference>,
5288
5289    #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
5290    pub reactions: Option<GroupPreference>,
5291
5292    #[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
5293    pub voice: Option<RoleGroupPreference>,
5294
5295    #[serde(rename = "files", skip_serializing_if = "Option::is_none")]
5296    pub files: Option<RoleGroupPreference>,
5297
5298    #[serde(rename = "simplexLinks", skip_serializing_if = "Option::is_none")]
5299    pub simplex_links: Option<RoleGroupPreference>,
5300
5301    #[serde(rename = "reports", skip_serializing_if = "Option::is_none")]
5302    pub reports: Option<GroupPreference>,
5303
5304    #[serde(rename = "history", skip_serializing_if = "Option::is_none")]
5305    pub history: Option<GroupPreference>,
5306
5307    #[serde(rename = "support", skip_serializing_if = "Option::is_none")]
5308    pub support: Option<SupportGroupPreference>,
5309
5310    #[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
5311    pub sessions: Option<RoleGroupPreference>,
5312
5313    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
5314    pub comments: Option<CommentsGroupPreference>,
5315
5316    #[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
5317    pub commands: Option<Vec<ChatBotCommand>>,
5318
5319    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5320    #[cfg_attr(feature = "bon", builder(default))]
5321    pub undocumented: JsonObject,
5322}
5323
5324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5325#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5326#[cfg_attr(feature = "bon", builder(on(String, into)))]
5327pub struct GroupProfile {
5328    #[serde(rename = "displayName")]
5329    pub display_name: String,
5330
5331    #[serde(rename = "fullName")]
5332    pub full_name: String,
5333
5334    #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
5335    pub short_descr: Option<String>,
5336
5337    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
5338    pub description: Option<String>,
5339
5340    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
5341    pub image: Option<String>,
5342
5343    #[serde(rename = "publicGroup", skip_serializing_if = "Option::is_none")]
5344    pub public_group: Option<PublicGroupProfile>,
5345
5346    #[serde(rename = "groupPreferences", skip_serializing_if = "Option::is_none")]
5347    pub group_preferences: Option<GroupPreferences>,
5348
5349    #[serde(rename = "memberAdmission", skip_serializing_if = "Option::is_none")]
5350    pub member_admission: Option<GroupMemberAdmission>,
5351
5352    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5353    #[cfg_attr(feature = "bon", builder(default))]
5354    pub undocumented: JsonObject,
5355}
5356
5357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5358#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5359#[cfg_attr(feature = "bon", builder(on(String, into)))]
5360pub struct GroupRelay {
5361    #[serde(
5362        rename = "groupRelayId",
5363        deserialize_with = "deserialize_number_from_string"
5364    )]
5365    pub group_relay_id: i64,
5366
5367    #[serde(
5368        rename = "groupMemberId",
5369        deserialize_with = "deserialize_number_from_string"
5370    )]
5371    pub group_member_id: i64,
5372
5373    #[serde(rename = "userChatRelay")]
5374    pub user_chat_relay: UserChatRelay,
5375
5376    #[serde(rename = "relayStatus")]
5377    pub relay_status: RelayStatus,
5378
5379    #[serde(rename = "relayLink", skip_serializing_if = "Option::is_none")]
5380    pub relay_link: Option<String>,
5381
5382    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5383    #[cfg_attr(feature = "bon", builder(default))]
5384    pub undocumented: JsonObject,
5385}
5386
5387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5388#[serde(tag = "type")]
5389#[non_exhaustive]
5390pub enum GroupRootKey {
5391    #[serde(rename = "private")]
5392    Private {
5393        #[serde(rename = "rootPrivKey")]
5394        root_priv_key: String,
5395
5396        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5397        undocumented: JsonObject,
5398    },
5399    #[serde(rename = "public")]
5400    Public {
5401        #[serde(rename = "rootPubKey")]
5402        root_pub_key: String,
5403
5404        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5405        undocumented: JsonObject,
5406    },
5407    #[serde(untagged)]
5408    Undocumented(JsonObject),
5409}
5410
5411impl GroupRootKey {
5412    pub fn make_private(root_priv_key: String) -> Self {
5413        Self::Private {
5414            root_priv_key,
5415            undocumented: Default::default(),
5416        }
5417    }
5418
5419    pub fn make_public(root_pub_key: String) -> Self {
5420        Self::Public {
5421            root_pub_key,
5422            undocumented: Default::default(),
5423        }
5424    }
5425}
5426
5427impl GroupRootKey {
5428    pub fn private(&self) -> Option<&String> {
5429        if let Self::Private { root_priv_key, .. } = self {
5430            Some(root_priv_key)
5431        } else {
5432            None
5433        }
5434    }
5435    pub fn public(&self) -> Option<&String> {
5436        if let Self::Public { root_pub_key, .. } = self {
5437            Some(root_pub_key)
5438        } else {
5439            None
5440        }
5441    }
5442}
5443
5444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5445#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5446#[cfg_attr(feature = "bon", builder(on(String, into)))]
5447pub struct GroupShortLinkData {
5448    #[serde(rename = "groupProfile")]
5449    pub group_profile: GroupProfile,
5450
5451    #[serde(rename = "publicGroupData", skip_serializing_if = "Option::is_none")]
5452    pub public_group_data: Option<PublicGroupData>,
5453
5454    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5455    #[cfg_attr(feature = "bon", builder(default))]
5456    pub undocumented: JsonObject,
5457}
5458
5459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5460#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5461#[cfg_attr(feature = "bon", builder(on(String, into)))]
5462pub struct GroupShortLinkInfo {
5463    #[serde(rename = "direct", default)]
5464    pub direct: bool,
5465
5466    #[serde(rename = "groupRelays")]
5467    pub group_relays: Vec<String>,
5468
5469    #[serde(rename = "publicGroupId", skip_serializing_if = "Option::is_none")]
5470    pub public_group_id: Option<String>,
5471
5472    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5473    #[cfg_attr(feature = "bon", builder(default))]
5474    pub undocumented: JsonObject,
5475}
5476
5477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5478#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5479#[cfg_attr(feature = "bon", builder(on(String, into)))]
5480pub struct GroupSummary {
5481    #[serde(
5482        rename = "currentMembers",
5483        deserialize_with = "deserialize_number_from_string"
5484    )]
5485    pub current_members: i64,
5486
5487    #[serde(
5488        rename = "publicMemberCount",
5489        skip_serializing_if = "Option::is_none",
5490        deserialize_with = "deserialize_option_number_from_string",
5491        default
5492    )]
5493    pub public_member_count: Option<i64>,
5494
5495    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5496    #[cfg_attr(feature = "bon", builder(default))]
5497    pub undocumented: JsonObject,
5498}
5499
5500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5501#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5502#[cfg_attr(feature = "bon", builder(on(String, into)))]
5503pub struct GroupSupportChat {
5504    #[serde(rename = "chatTs")]
5505    pub chat_ts: UtcTime,
5506
5507    #[serde(rename = "unread", deserialize_with = "deserialize_number_from_string")]
5508    pub unread: i64,
5509
5510    #[serde(
5511        rename = "memberAttention",
5512        deserialize_with = "deserialize_number_from_string"
5513    )]
5514    pub member_attention: i64,
5515
5516    #[serde(
5517        rename = "mentions",
5518        deserialize_with = "deserialize_number_from_string"
5519    )]
5520    pub mentions: i64,
5521
5522    #[serde(
5523        rename = "lastMsgFromMemberTs",
5524        skip_serializing_if = "Option::is_none"
5525    )]
5526    pub last_msg_from_member_ts: Option<UtcTime>,
5527
5528    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5529    #[cfg_attr(feature = "bon", builder(default))]
5530    pub undocumented: JsonObject,
5531}
5532
5533#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5534#[non_exhaustive]
5535pub enum GroupType {
5536    #[default]
5537    #[serde(rename = "channel")]
5538    Channel,
5539    #[serde(rename = "group")]
5540    Group,
5541}
5542
5543#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5544#[non_exhaustive]
5545pub enum InlineFileMode {
5546    #[default]
5547    #[serde(rename = "offer")]
5548    Offer,
5549    #[serde(rename = "sent")]
5550    Sent,
5551}
5552
5553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5554#[serde(tag = "type")]
5555#[non_exhaustive]
5556pub enum InvitationLinkPlan {
5557    #[serde(rename = "ok")]
5558    Ok {
5559        #[serde(rename = "contactSLinkData_", skip_serializing_if = "Option::is_none")]
5560        contact_s_link_data: Option<ContactShortLinkData>,
5561
5562        #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
5563        owner_verification: Option<OwnerVerification>,
5564
5565        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5566        undocumented: JsonObject,
5567    },
5568    #[serde(rename = "ownLink")]
5569    OwnLink,
5570    #[serde(rename = "connecting")]
5571    Connecting {
5572        #[serde(rename = "contact_", skip_serializing_if = "Option::is_none")]
5573        contact: Option<Contact>,
5574
5575        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5576        undocumented: JsonObject,
5577    },
5578    #[serde(rename = "known")]
5579    Known {
5580        #[serde(rename = "contact")]
5581        contact: Contact,
5582
5583        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5584        undocumented: JsonObject,
5585    },
5586    #[serde(untagged)]
5587    Undocumented(JsonObject),
5588}
5589
5590impl InvitationLinkPlan {
5591    pub fn make_ok(
5592        contact_s_link_data: Option<ContactShortLinkData>,
5593        owner_verification: Option<OwnerVerification>,
5594    ) -> Self {
5595        Self::Ok {
5596            contact_s_link_data,
5597            owner_verification,
5598            undocumented: Default::default(),
5599        }
5600    }
5601
5602    pub fn make_own_link() -> Self {
5603        Self::OwnLink
5604    }
5605
5606    pub fn make_connecting(contact: Option<Contact>) -> Self {
5607        Self::Connecting {
5608            contact,
5609            undocumented: Default::default(),
5610        }
5611    }
5612
5613    pub fn make_known(contact: Contact) -> Self {
5614        Self::Known {
5615            contact,
5616            undocumented: Default::default(),
5617        }
5618    }
5619}
5620
5621impl InvitationLinkPlan {
5622    pub fn ok(&self) -> Option<InvitationLinkPlanOkRef<'_>> {
5623        if let Self::Ok {
5624            contact_s_link_data,
5625            owner_verification,
5626            ..
5627        } = self
5628        {
5629            Some(InvitationLinkPlanOkRef {
5630                contact_s_link_data,
5631                owner_verification,
5632            })
5633        } else {
5634            None
5635        }
5636    }
5637    pub fn is_own_link(&self) -> bool {
5638        matches!(self, Self::OwnLink)
5639    }
5640    pub fn connecting(&self) -> Option<&Option<Contact>> {
5641        if let Self::Connecting { contact, .. } = self {
5642            Some(contact)
5643        } else {
5644            None
5645        }
5646    }
5647    pub fn known(&self) -> Option<&Contact> {
5648        if let Self::Known { contact, .. } = self {
5649            Some(contact)
5650        } else {
5651            None
5652        }
5653    }
5654}
5655#[derive(Clone, Copy)]
5656pub struct InvitationLinkPlanOkRef<'a> {
5657    pub contact_s_link_data: &'a Option<ContactShortLinkData>,
5658    pub owner_verification: &'a Option<OwnerVerification>,
5659}
5660
5661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5662#[serde(tag = "type")]
5663#[non_exhaustive]
5664pub enum InvitedBy {
5665    #[serde(rename = "contact")]
5666    Contact {
5667        #[serde(
5668            rename = "byContactId",
5669            deserialize_with = "deserialize_number_from_string"
5670        )]
5671        by_contact_id: i64,
5672
5673        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5674        undocumented: JsonObject,
5675    },
5676    #[serde(rename = "user")]
5677    User,
5678    #[serde(rename = "unknown")]
5679    Unknown,
5680    #[serde(untagged)]
5681    Undocumented(JsonObject),
5682}
5683
5684impl InvitedBy {
5685    pub fn make_contact(by_contact_id: i64) -> Self {
5686        Self::Contact {
5687            by_contact_id,
5688            undocumented: Default::default(),
5689        }
5690    }
5691
5692    pub fn make_user() -> Self {
5693        Self::User
5694    }
5695
5696    pub fn make_unknown() -> Self {
5697        Self::Unknown
5698    }
5699}
5700
5701impl InvitedBy {
5702    pub fn contact(&self) -> Option<&i64> {
5703        if let Self::Contact { by_contact_id, .. } = self {
5704            Some(by_contact_id)
5705        } else {
5706            None
5707        }
5708    }
5709    pub fn is_user(&self) -> bool {
5710        matches!(self, Self::User)
5711    }
5712    pub fn is_unknown(&self) -> bool {
5713        matches!(self, Self::Unknown)
5714    }
5715}
5716
5717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5718#[serde(tag = "type")]
5719#[non_exhaustive]
5720pub enum LinkContent {
5721    #[serde(rename = "page")]
5722    Page,
5723    #[serde(rename = "image")]
5724    Image,
5725    #[serde(rename = "video")]
5726    Video {
5727        #[serde(
5728            rename = "duration",
5729            skip_serializing_if = "Option::is_none",
5730            deserialize_with = "deserialize_option_number_from_string",
5731            default
5732        )]
5733        duration: Option<i32>,
5734
5735        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5736        undocumented: JsonObject,
5737    },
5738    #[serde(rename = "unknown")]
5739    Unknown {
5740        #[serde(rename = "tag")]
5741        tag: String,
5742
5743        #[serde(rename = "json")]
5744        json: JsonObject,
5745
5746        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5747        undocumented: JsonObject,
5748    },
5749    #[serde(untagged)]
5750    Undocumented(JsonObject),
5751}
5752
5753impl LinkContent {
5754    pub fn make_page() -> Self {
5755        Self::Page
5756    }
5757
5758    pub fn make_image() -> Self {
5759        Self::Image
5760    }
5761
5762    pub fn make_video(duration: Option<i32>) -> Self {
5763        Self::Video {
5764            duration,
5765            undocumented: Default::default(),
5766        }
5767    }
5768
5769    pub fn make_unknown(tag: String, json: JsonObject) -> Self {
5770        Self::Unknown {
5771            tag,
5772            json,
5773            undocumented: Default::default(),
5774        }
5775    }
5776}
5777
5778impl LinkContent {
5779    pub fn is_page(&self) -> bool {
5780        matches!(self, Self::Page)
5781    }
5782    pub fn is_image(&self) -> bool {
5783        matches!(self, Self::Image)
5784    }
5785    pub fn video(&self) -> Option<&Option<i32>> {
5786        if let Self::Video { duration, .. } = self {
5787            Some(duration)
5788        } else {
5789            None
5790        }
5791    }
5792    pub fn unknown(&self) -> Option<LinkContentUnknownRef<'_>> {
5793        if let Self::Unknown { tag, json, .. } = self {
5794            Some(LinkContentUnknownRef { tag, json })
5795        } else {
5796            None
5797        }
5798    }
5799}
5800#[derive(Clone, Copy)]
5801pub struct LinkContentUnknownRef<'a> {
5802    pub tag: &'a String,
5803    pub json: &'a JsonObject,
5804}
5805
5806#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5807#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5808#[cfg_attr(feature = "bon", builder(on(String, into)))]
5809pub struct LinkOwnerSig {
5810    #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")]
5811    pub owner_id: Option<String>,
5812
5813    #[serde(rename = "chatBinding")]
5814    pub chat_binding: String,
5815
5816    #[serde(rename = "ownerSig")]
5817    pub owner_sig: String,
5818
5819    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5820    #[cfg_attr(feature = "bon", builder(default))]
5821    pub undocumented: JsonObject,
5822}
5823
5824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5825#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5826#[cfg_attr(feature = "bon", builder(on(String, into)))]
5827pub struct LinkPreview {
5828    #[serde(rename = "uri")]
5829    pub uri: String,
5830
5831    #[serde(rename = "title")]
5832    pub title: String,
5833
5834    #[serde(rename = "description")]
5835    pub description: String,
5836
5837    #[serde(rename = "image")]
5838    pub image: String,
5839
5840    #[serde(rename = "content", skip_serializing_if = "Option::is_none")]
5841    pub content: Option<LinkContent>,
5842
5843    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5844    #[cfg_attr(feature = "bon", builder(default))]
5845    pub undocumented: JsonObject,
5846}
5847
5848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5849#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5850#[cfg_attr(feature = "bon", builder(on(String, into)))]
5851pub struct LocalProfile {
5852    #[serde(
5853        rename = "profileId",
5854        deserialize_with = "deserialize_number_from_string"
5855    )]
5856    pub profile_id: i64,
5857
5858    #[serde(rename = "displayName")]
5859    pub display_name: String,
5860
5861    #[serde(rename = "fullName")]
5862    pub full_name: String,
5863
5864    #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
5865    pub short_descr: Option<String>,
5866
5867    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
5868    pub image: Option<String>,
5869
5870    #[serde(rename = "contactLink", skip_serializing_if = "Option::is_none")]
5871    pub contact_link: Option<String>,
5872
5873    #[serde(rename = "preferences", skip_serializing_if = "Option::is_none")]
5874    pub preferences: Option<Preferences>,
5875
5876    #[serde(rename = "peerType", skip_serializing_if = "Option::is_none")]
5877    pub peer_type: Option<ChatPeerType>,
5878
5879    #[serde(rename = "localAlias")]
5880    pub local_alias: String,
5881
5882    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5883    #[cfg_attr(feature = "bon", builder(default))]
5884    pub undocumented: JsonObject,
5885}
5886
5887#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5888#[non_exhaustive]
5889pub enum MemberCriteria {
5890    #[default]
5891    #[serde(rename = "all")]
5892    All,
5893}
5894
5895/// Connection link sent in a message - only short links are allowed.
5896#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5897#[serde(tag = "type")]
5898#[non_exhaustive]
5899pub enum MsgChatLink {
5900    #[serde(rename = "contact")]
5901    Contact {
5902        #[serde(rename = "connLink")]
5903        conn_link: String,
5904
5905        #[serde(rename = "profile")]
5906        profile: Profile,
5907
5908        #[serde(rename = "business", default)]
5909        business: bool,
5910
5911        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5912        undocumented: JsonObject,
5913    },
5914    #[serde(rename = "invitation")]
5915    Invitation {
5916        #[serde(rename = "invLink")]
5917        inv_link: String,
5918
5919        #[serde(rename = "profile")]
5920        profile: Profile,
5921
5922        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5923        undocumented: JsonObject,
5924    },
5925    #[serde(rename = "group")]
5926    Group {
5927        #[serde(rename = "connLink")]
5928        conn_link: String,
5929
5930        #[serde(rename = "groupProfile")]
5931        group_profile: GroupProfile,
5932
5933        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5934        undocumented: JsonObject,
5935    },
5936    #[serde(untagged)]
5937    Undocumented(JsonObject),
5938}
5939
5940impl MsgChatLink {
5941    pub fn make_contact(conn_link: String, profile: Profile, business: bool) -> Self {
5942        Self::Contact {
5943            conn_link,
5944            profile,
5945            business,
5946            undocumented: Default::default(),
5947        }
5948    }
5949
5950    pub fn make_invitation(inv_link: String, profile: Profile) -> Self {
5951        Self::Invitation {
5952            inv_link,
5953            profile,
5954            undocumented: Default::default(),
5955        }
5956    }
5957
5958    pub fn make_group(conn_link: String, group_profile: GroupProfile) -> Self {
5959        Self::Group {
5960            conn_link,
5961            group_profile,
5962            undocumented: Default::default(),
5963        }
5964    }
5965}
5966
5967impl MsgChatLink {
5968    pub fn contact(&self) -> Option<MsgChatLinkContactRef<'_>> {
5969        if let Self::Contact {
5970            conn_link,
5971            profile,
5972            business,
5973            ..
5974        } = self
5975        {
5976            Some(MsgChatLinkContactRef {
5977                conn_link,
5978                profile,
5979                business,
5980            })
5981        } else {
5982            None
5983        }
5984    }
5985    pub fn invitation(&self) -> Option<MsgChatLinkInvitationRef<'_>> {
5986        if let Self::Invitation {
5987            inv_link, profile, ..
5988        } = self
5989        {
5990            Some(MsgChatLinkInvitationRef { inv_link, profile })
5991        } else {
5992            None
5993        }
5994    }
5995    pub fn group(&self) -> Option<MsgChatLinkGroupRef<'_>> {
5996        if let Self::Group {
5997            conn_link,
5998            group_profile,
5999            ..
6000        } = self
6001        {
6002            Some(MsgChatLinkGroupRef {
6003                conn_link,
6004                group_profile,
6005            })
6006        } else {
6007            None
6008        }
6009    }
6010}
6011#[derive(Clone, Copy)]
6012pub struct MsgChatLinkContactRef<'a> {
6013    pub conn_link: &'a String,
6014    pub profile: &'a Profile,
6015    pub business: &'a bool,
6016}
6017#[derive(Clone, Copy)]
6018pub struct MsgChatLinkInvitationRef<'a> {
6019    pub inv_link: &'a String,
6020    pub profile: &'a Profile,
6021}
6022#[derive(Clone, Copy)]
6023pub struct MsgChatLinkGroupRef<'a> {
6024    pub conn_link: &'a String,
6025    pub group_profile: &'a GroupProfile,
6026}
6027
6028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6029#[serde(tag = "type")]
6030#[non_exhaustive]
6031pub enum MsgContent {
6032    #[serde(rename = "text")]
6033    Text {
6034        #[serde(rename = "text")]
6035        text: String,
6036
6037        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6038        undocumented: JsonObject,
6039    },
6040    #[serde(rename = "link")]
6041    Link {
6042        #[serde(rename = "text")]
6043        text: String,
6044
6045        #[serde(rename = "preview")]
6046        preview: LinkPreview,
6047
6048        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6049        undocumented: JsonObject,
6050    },
6051    #[serde(rename = "image")]
6052    Image {
6053        #[serde(rename = "text")]
6054        text: String,
6055
6056        #[serde(rename = "image")]
6057        image: String,
6058
6059        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6060        undocumented: JsonObject,
6061    },
6062    #[serde(rename = "video")]
6063    Video {
6064        #[serde(rename = "text")]
6065        text: String,
6066
6067        #[serde(rename = "image")]
6068        image: String,
6069
6070        #[serde(
6071            rename = "duration",
6072            deserialize_with = "deserialize_number_from_string"
6073        )]
6074        duration: i32,
6075
6076        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6077        undocumented: JsonObject,
6078    },
6079    #[serde(rename = "voice")]
6080    Voice {
6081        #[serde(rename = "text")]
6082        text: String,
6083
6084        #[serde(
6085            rename = "duration",
6086            deserialize_with = "deserialize_number_from_string"
6087        )]
6088        duration: i32,
6089
6090        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6091        undocumented: JsonObject,
6092    },
6093    #[serde(rename = "file")]
6094    File {
6095        #[serde(rename = "text")]
6096        text: String,
6097
6098        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6099        undocumented: JsonObject,
6100    },
6101    #[serde(rename = "report")]
6102    Report {
6103        #[serde(rename = "text")]
6104        text: String,
6105
6106        #[serde(rename = "reason")]
6107        reason: ReportReason,
6108
6109        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6110        undocumented: JsonObject,
6111    },
6112    #[serde(rename = "chat")]
6113    Chat {
6114        #[serde(rename = "text")]
6115        text: String,
6116
6117        #[serde(rename = "chatLink")]
6118        chat_link: MsgChatLink,
6119
6120        #[serde(rename = "ownerSig", skip_serializing_if = "Option::is_none")]
6121        owner_sig: Option<LinkOwnerSig>,
6122
6123        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6124        undocumented: JsonObject,
6125    },
6126    #[serde(rename = "unknown")]
6127    Unknown {
6128        #[serde(rename = "tag")]
6129        tag: String,
6130
6131        #[serde(rename = "text")]
6132        text: String,
6133
6134        #[serde(rename = "json")]
6135        json: JsonObject,
6136
6137        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6138        undocumented: JsonObject,
6139    },
6140    #[serde(untagged)]
6141    Undocumented(JsonObject),
6142}
6143
6144impl MsgContent {
6145    pub fn make_text(text: String) -> Self {
6146        Self::Text {
6147            text,
6148            undocumented: Default::default(),
6149        }
6150    }
6151
6152    pub fn make_link(text: String, preview: LinkPreview) -> Self {
6153        Self::Link {
6154            text,
6155            preview,
6156            undocumented: Default::default(),
6157        }
6158    }
6159
6160    pub fn make_image(text: String, image: String) -> Self {
6161        Self::Image {
6162            text,
6163            image,
6164            undocumented: Default::default(),
6165        }
6166    }
6167
6168    pub fn make_video(text: String, image: String, duration: i32) -> Self {
6169        Self::Video {
6170            text,
6171            image,
6172            duration,
6173            undocumented: Default::default(),
6174        }
6175    }
6176
6177    pub fn make_voice(text: String, duration: i32) -> Self {
6178        Self::Voice {
6179            text,
6180            duration,
6181            undocumented: Default::default(),
6182        }
6183    }
6184
6185    pub fn make_file(text: String) -> Self {
6186        Self::File {
6187            text,
6188            undocumented: Default::default(),
6189        }
6190    }
6191
6192    pub fn make_report(text: String, reason: ReportReason) -> Self {
6193        Self::Report {
6194            text,
6195            reason,
6196            undocumented: Default::default(),
6197        }
6198    }
6199
6200    pub fn make_chat(
6201        text: String,
6202        chat_link: MsgChatLink,
6203        owner_sig: Option<LinkOwnerSig>,
6204    ) -> Self {
6205        Self::Chat {
6206            text,
6207            chat_link,
6208            owner_sig,
6209            undocumented: Default::default(),
6210        }
6211    }
6212
6213    pub fn make_unknown(tag: String, text: String, json: JsonObject) -> Self {
6214        Self::Unknown {
6215            tag,
6216            text,
6217            json,
6218            undocumented: Default::default(),
6219        }
6220    }
6221}
6222
6223impl MsgContent {
6224    pub fn text(&self) -> Option<&String> {
6225        if let Self::Text { text, .. } = self {
6226            Some(text)
6227        } else {
6228            None
6229        }
6230    }
6231    pub fn link(&self) -> Option<MsgContentLinkRef<'_>> {
6232        if let Self::Link { text, preview, .. } = self {
6233            Some(MsgContentLinkRef { text, preview })
6234        } else {
6235            None
6236        }
6237    }
6238    pub fn image(&self) -> Option<MsgContentImageRef<'_>> {
6239        if let Self::Image { text, image, .. } = self {
6240            Some(MsgContentImageRef { text, image })
6241        } else {
6242            None
6243        }
6244    }
6245    pub fn video(&self) -> Option<MsgContentVideoRef<'_>> {
6246        if let Self::Video {
6247            text,
6248            image,
6249            duration,
6250            ..
6251        } = self
6252        {
6253            Some(MsgContentVideoRef {
6254                text,
6255                image,
6256                duration,
6257            })
6258        } else {
6259            None
6260        }
6261    }
6262    pub fn voice(&self) -> Option<MsgContentVoiceRef<'_>> {
6263        if let Self::Voice { text, duration, .. } = self {
6264            Some(MsgContentVoiceRef { text, duration })
6265        } else {
6266            None
6267        }
6268    }
6269    pub fn file(&self) -> Option<&String> {
6270        if let Self::File { text, .. } = self {
6271            Some(text)
6272        } else {
6273            None
6274        }
6275    }
6276    pub fn report(&self) -> Option<MsgContentReportRef<'_>> {
6277        if let Self::Report { text, reason, .. } = self {
6278            Some(MsgContentReportRef { text, reason })
6279        } else {
6280            None
6281        }
6282    }
6283    pub fn chat(&self) -> Option<MsgContentChatRef<'_>> {
6284        if let Self::Chat {
6285            text,
6286            chat_link,
6287            owner_sig,
6288            ..
6289        } = self
6290        {
6291            Some(MsgContentChatRef {
6292                text,
6293                chat_link,
6294                owner_sig,
6295            })
6296        } else {
6297            None
6298        }
6299    }
6300    pub fn unknown(&self) -> Option<MsgContentUnknownRef<'_>> {
6301        if let Self::Unknown {
6302            tag, text, json, ..
6303        } = self
6304        {
6305            Some(MsgContentUnknownRef { tag, text, json })
6306        } else {
6307            None
6308        }
6309    }
6310}
6311#[derive(Clone, Copy)]
6312pub struct MsgContentLinkRef<'a> {
6313    pub text: &'a String,
6314    pub preview: &'a LinkPreview,
6315}
6316#[derive(Clone, Copy)]
6317pub struct MsgContentImageRef<'a> {
6318    pub text: &'a String,
6319    pub image: &'a String,
6320}
6321#[derive(Clone, Copy)]
6322pub struct MsgContentVideoRef<'a> {
6323    pub text: &'a String,
6324    pub image: &'a String,
6325    pub duration: &'a i32,
6326}
6327#[derive(Clone, Copy)]
6328pub struct MsgContentVoiceRef<'a> {
6329    pub text: &'a String,
6330    pub duration: &'a i32,
6331}
6332#[derive(Clone, Copy)]
6333pub struct MsgContentReportRef<'a> {
6334    pub text: &'a String,
6335    pub reason: &'a ReportReason,
6336}
6337#[derive(Clone, Copy)]
6338pub struct MsgContentChatRef<'a> {
6339    pub text: &'a String,
6340    pub chat_link: &'a MsgChatLink,
6341    pub owner_sig: &'a Option<LinkOwnerSig>,
6342}
6343#[derive(Clone, Copy)]
6344pub struct MsgContentUnknownRef<'a> {
6345    pub tag: &'a String,
6346    pub text: &'a String,
6347    pub json: &'a JsonObject,
6348}
6349
6350#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6351#[non_exhaustive]
6352pub enum MsgDirection {
6353    #[default]
6354    #[serde(rename = "rcv")]
6355    Rcv,
6356    #[serde(rename = "snd")]
6357    Snd,
6358}
6359
6360#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6361#[non_exhaustive]
6362pub enum MsgFilter {
6363    #[default]
6364    #[serde(rename = "none")]
6365    None,
6366    #[serde(rename = "all")]
6367    All,
6368    #[serde(rename = "mentions")]
6369    Mentions,
6370}
6371
6372#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6373#[serde(tag = "type")]
6374#[non_exhaustive]
6375pub enum MsgReaction {
6376    #[serde(rename = "emoji")]
6377    Emoji {
6378        #[serde(rename = "emoji")]
6379        emoji: String,
6380
6381        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6382        undocumented: JsonObject,
6383    },
6384    #[serde(rename = "unknown")]
6385    Unknown {
6386        #[serde(rename = "tag")]
6387        tag: String,
6388
6389        #[serde(rename = "json")]
6390        json: JsonObject,
6391
6392        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6393        undocumented: JsonObject,
6394    },
6395    #[serde(untagged)]
6396    Undocumented(JsonObject),
6397}
6398
6399impl MsgReaction {
6400    pub fn make_emoji(emoji: String) -> Self {
6401        Self::Emoji {
6402            emoji,
6403            undocumented: Default::default(),
6404        }
6405    }
6406
6407    pub fn make_unknown(tag: String, json: JsonObject) -> Self {
6408        Self::Unknown {
6409            tag,
6410            json,
6411            undocumented: Default::default(),
6412        }
6413    }
6414}
6415
6416impl MsgReaction {
6417    pub fn emoji(&self) -> Option<&String> {
6418        if let Self::Emoji { emoji, .. } = self {
6419            Some(emoji)
6420        } else {
6421            None
6422        }
6423    }
6424    pub fn unknown(&self) -> Option<MsgReactionUnknownRef<'_>> {
6425        if let Self::Unknown { tag, json, .. } = self {
6426            Some(MsgReactionUnknownRef { tag, json })
6427        } else {
6428            None
6429        }
6430    }
6431}
6432#[derive(Clone, Copy)]
6433pub struct MsgReactionUnknownRef<'a> {
6434    pub tag: &'a String,
6435    pub json: &'a JsonObject,
6436}
6437
6438#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6439#[non_exhaustive]
6440pub enum MsgReceiptStatus {
6441    #[default]
6442    #[serde(rename = "ok")]
6443    Ok,
6444    #[serde(rename = "badMsgHash")]
6445    BadMsgHash,
6446}
6447
6448#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6449#[non_exhaustive]
6450pub enum MsgSigStatus {
6451    #[default]
6452    #[serde(rename = "verified")]
6453    Verified,
6454    #[serde(rename = "signedNoKey")]
6455    SignedNoKey,
6456}
6457
6458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6459#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6460#[cfg_attr(feature = "bon", builder(on(String, into)))]
6461pub struct NewUser {
6462    #[serde(rename = "profile", skip_serializing_if = "Option::is_none")]
6463    pub profile: Option<Profile>,
6464
6465    #[serde(rename = "pastTimestamp", default)]
6466    pub past_timestamp: bool,
6467
6468    #[serde(rename = "userChatRelay", default)]
6469    pub user_chat_relay: bool,
6470
6471    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6472    #[cfg_attr(feature = "bon", builder(default))]
6473    pub undocumented: JsonObject,
6474}
6475
6476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6477#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6478#[cfg_attr(feature = "bon", builder(on(String, into)))]
6479pub struct NoteFolder {
6480    #[serde(
6481        rename = "noteFolderId",
6482        deserialize_with = "deserialize_number_from_string"
6483    )]
6484    pub note_folder_id: i64,
6485
6486    #[serde(rename = "userId", deserialize_with = "deserialize_number_from_string")]
6487    pub user_id: i64,
6488
6489    #[serde(rename = "createdAt")]
6490    pub created_at: UtcTime,
6491
6492    #[serde(rename = "updatedAt")]
6493    pub updated_at: UtcTime,
6494
6495    #[serde(rename = "chatTs")]
6496    pub chat_ts: UtcTime,
6497
6498    #[serde(rename = "favorite", default)]
6499    pub favorite: bool,
6500
6501    #[serde(rename = "unread", default)]
6502    pub unread: bool,
6503
6504    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6505    #[cfg_attr(feature = "bon", builder(default))]
6506    pub undocumented: JsonObject,
6507}
6508
6509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6510#[serde(tag = "type")]
6511#[non_exhaustive]
6512pub enum OwnerVerification {
6513    #[serde(rename = "verified")]
6514    Verified,
6515    #[serde(rename = "failed")]
6516    Failed {
6517        #[serde(rename = "reason")]
6518        reason: String,
6519
6520        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6521        undocumented: JsonObject,
6522    },
6523    #[serde(untagged)]
6524    Undocumented(JsonObject),
6525}
6526
6527impl OwnerVerification {
6528    pub fn make_verified() -> Self {
6529        Self::Verified
6530    }
6531
6532    pub fn make_failed(reason: String) -> Self {
6533        Self::Failed {
6534            reason,
6535            undocumented: Default::default(),
6536        }
6537    }
6538}
6539
6540impl OwnerVerification {
6541    pub fn is_verified(&self) -> bool {
6542        matches!(self, Self::Verified)
6543    }
6544    pub fn failed(&self) -> Option<&String> {
6545        if let Self::Failed { reason, .. } = self {
6546            Some(reason)
6547        } else {
6548            None
6549        }
6550    }
6551}
6552
6553/// *Syntax:*
6554///
6555/// ```
6556/// count=<count>
6557/// ```
6558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6559#[serde(tag = "type")]
6560#[non_exhaustive]
6561pub enum PaginationByTime {
6562    #[serde(rename = "last")]
6563    Last {
6564        #[serde(rename = "count", deserialize_with = "deserialize_number_from_string")]
6565        count: i32,
6566
6567        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6568        undocumented: JsonObject,
6569    },
6570    #[serde(untagged)]
6571    Undocumented(JsonObject),
6572}
6573
6574impl CommandSyntax for PaginationByTime {
6575    const COMMAND_BUF_SIZE: usize = 32;
6576
6577    fn append_command_syntax(&self, buf: &mut String) {
6578        match self {
6579            Self::Last {
6580                count,
6581                undocumented: _,
6582            } => {
6583                buf.push_str("count=");
6584                write!(buf, "{count}").unwrap();
6585            }
6586            Self::Undocumented(_) => {}
6587        }
6588    }
6589}
6590
6591impl PaginationByTime {
6592    pub fn make_last(count: i32) -> Self {
6593        Self::Last {
6594            count,
6595            undocumented: Default::default(),
6596        }
6597    }
6598}
6599
6600impl PaginationByTime {
6601    pub fn last(&self) -> Option<&i32> {
6602        if let Self::Last { count, .. } = self {
6603            Some(count)
6604        } else {
6605            None
6606        }
6607    }
6608}
6609
6610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6611#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6612#[cfg_attr(feature = "bon", builder(on(String, into)))]
6613pub struct PendingContactConnection {
6614    #[serde(
6615        rename = "pccConnId",
6616        deserialize_with = "deserialize_number_from_string"
6617    )]
6618    pub pcc_conn_id: i64,
6619
6620    #[serde(rename = "pccAgentConnId")]
6621    pub pcc_agent_conn_id: String,
6622
6623    #[serde(rename = "pccConnStatus")]
6624    pub pcc_conn_status: ConnStatus,
6625
6626    #[serde(rename = "viaContactUri", default)]
6627    pub via_contact_uri: bool,
6628
6629    #[serde(
6630        rename = "viaUserContactLink",
6631        skip_serializing_if = "Option::is_none",
6632        deserialize_with = "deserialize_option_number_from_string",
6633        default
6634    )]
6635    pub via_user_contact_link: Option<i64>,
6636
6637    #[serde(rename = "groupLinkId", skip_serializing_if = "Option::is_none")]
6638    pub group_link_id: Option<String>,
6639
6640    #[serde(
6641        rename = "customUserProfileId",
6642        skip_serializing_if = "Option::is_none",
6643        deserialize_with = "deserialize_option_number_from_string",
6644        default
6645    )]
6646    pub custom_user_profile_id: Option<i64>,
6647
6648    #[serde(rename = "connLinkInv", skip_serializing_if = "Option::is_none")]
6649    pub conn_link_inv: Option<CreatedConnLink>,
6650
6651    #[serde(rename = "localAlias")]
6652    pub local_alias: String,
6653
6654    #[serde(rename = "createdAt")]
6655    pub created_at: UtcTime,
6656
6657    #[serde(rename = "updatedAt")]
6658    pub updated_at: UtcTime,
6659
6660    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6661    #[cfg_attr(feature = "bon", builder(default))]
6662    pub undocumented: JsonObject,
6663}
6664
6665#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6666#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6667#[cfg_attr(feature = "bon", builder(on(String, into)))]
6668pub struct PrefEnabled {
6669    #[serde(rename = "forUser", default)]
6670    pub for_user: bool,
6671
6672    #[serde(rename = "forContact", default)]
6673    pub for_contact: bool,
6674
6675    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6676    #[cfg_attr(feature = "bon", builder(default))]
6677    pub undocumented: JsonObject,
6678}
6679
6680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6681#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6682#[cfg_attr(feature = "bon", builder(on(String, into)))]
6683pub struct Preferences {
6684    #[serde(rename = "timedMessages", skip_serializing_if = "Option::is_none")]
6685    pub timed_messages: Option<TimedMessagesPreference>,
6686
6687    #[serde(rename = "fullDelete", skip_serializing_if = "Option::is_none")]
6688    pub full_delete: Option<SimplePreference>,
6689
6690    #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
6691    pub reactions: Option<SimplePreference>,
6692
6693    #[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
6694    pub voice: Option<SimplePreference>,
6695
6696    #[serde(rename = "files", skip_serializing_if = "Option::is_none")]
6697    pub files: Option<SimplePreference>,
6698
6699    #[serde(rename = "calls", skip_serializing_if = "Option::is_none")]
6700    pub calls: Option<SimplePreference>,
6701
6702    #[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
6703    pub sessions: Option<SimplePreference>,
6704
6705    #[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
6706    pub commands: Option<Vec<ChatBotCommand>>,
6707
6708    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6709    #[cfg_attr(feature = "bon", builder(default))]
6710    pub undocumented: JsonObject,
6711}
6712
6713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6714#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6715#[cfg_attr(feature = "bon", builder(on(String, into)))]
6716pub struct PreparedContact {
6717    #[serde(rename = "connLinkToConnect")]
6718    pub conn_link_to_connect: CreatedConnLink,
6719
6720    #[serde(rename = "uiConnLinkType")]
6721    pub ui_conn_link_type: ConnectionMode,
6722
6723    #[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
6724    pub welcome_shared_msg_id: Option<String>,
6725
6726    #[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
6727    pub request_shared_msg_id: Option<String>,
6728
6729    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6730    #[cfg_attr(feature = "bon", builder(default))]
6731    pub undocumented: JsonObject,
6732}
6733
6734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6735#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6736#[cfg_attr(feature = "bon", builder(on(String, into)))]
6737pub struct PreparedGroup {
6738    #[serde(rename = "connLinkToConnect")]
6739    pub conn_link_to_connect: CreatedConnLink,
6740
6741    #[serde(rename = "connLinkPreparedConnection", default)]
6742    pub conn_link_prepared_connection: bool,
6743
6744    #[serde(rename = "connLinkStartedConnection", default)]
6745    pub conn_link_started_connection: bool,
6746
6747    #[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
6748    pub welcome_shared_msg_id: Option<String>,
6749
6750    #[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
6751    pub request_shared_msg_id: Option<String>,
6752
6753    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6754    #[cfg_attr(feature = "bon", builder(default))]
6755    pub undocumented: JsonObject,
6756}
6757
6758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6759#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6760#[cfg_attr(feature = "bon", builder(on(String, into)))]
6761pub struct Profile {
6762    #[serde(rename = "displayName")]
6763    pub display_name: String,
6764
6765    #[serde(rename = "fullName")]
6766    pub full_name: String,
6767
6768    #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
6769    pub short_descr: Option<String>,
6770
6771    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
6772    pub image: Option<String>,
6773
6774    #[serde(rename = "contactLink", skip_serializing_if = "Option::is_none")]
6775    pub contact_link: Option<String>,
6776
6777    #[serde(rename = "preferences", skip_serializing_if = "Option::is_none")]
6778    pub preferences: Option<Preferences>,
6779
6780    #[serde(rename = "peerType", skip_serializing_if = "Option::is_none")]
6781    pub peer_type: Option<ChatPeerType>,
6782
6783    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6784    #[cfg_attr(feature = "bon", builder(default))]
6785    pub undocumented: JsonObject,
6786}
6787
6788#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6789#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6790#[cfg_attr(feature = "bon", builder(on(String, into)))]
6791pub struct PublicGroupData {
6792    #[serde(
6793        rename = "publicMemberCount",
6794        deserialize_with = "deserialize_number_from_string"
6795    )]
6796    pub public_member_count: i64,
6797
6798    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6799    #[cfg_attr(feature = "bon", builder(default))]
6800    pub undocumented: JsonObject,
6801}
6802
6803#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6804#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6805#[cfg_attr(feature = "bon", builder(on(String, into)))]
6806pub struct PublicGroupProfile {
6807    #[serde(rename = "groupType")]
6808    pub group_type: GroupType,
6809
6810    #[serde(rename = "groupLink")]
6811    pub group_link: String,
6812
6813    #[serde(rename = "publicGroupId")]
6814    pub public_group_id: String,
6815
6816    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6817    #[cfg_attr(feature = "bon", builder(default))]
6818    pub undocumented: JsonObject,
6819}
6820
6821#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6822#[non_exhaustive]
6823pub enum RatchetSyncState {
6824    #[default]
6825    #[serde(rename = "ok")]
6826    Ok,
6827    #[serde(rename = "allowed")]
6828    Allowed,
6829    #[serde(rename = "required")]
6830    Required,
6831    #[serde(rename = "started")]
6832    Started,
6833    #[serde(rename = "agreed")]
6834    Agreed,
6835}
6836
6837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6838#[serde(tag = "type")]
6839#[non_exhaustive]
6840pub enum RcvConnEvent {
6841    #[serde(rename = "switchQueue")]
6842    SwitchQueue {
6843        #[serde(rename = "phase")]
6844        phase: SwitchPhase,
6845
6846        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6847        undocumented: JsonObject,
6848    },
6849    #[serde(rename = "ratchetSync")]
6850    RatchetSync {
6851        #[serde(rename = "syncStatus")]
6852        sync_status: RatchetSyncState,
6853
6854        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6855        undocumented: JsonObject,
6856    },
6857    #[serde(rename = "verificationCodeReset")]
6858    VerificationCodeReset,
6859    #[serde(rename = "pqEnabled")]
6860    PqEnabled {
6861        #[serde(rename = "enabled", default)]
6862        enabled: bool,
6863
6864        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6865        undocumented: JsonObject,
6866    },
6867    #[serde(untagged)]
6868    Undocumented(JsonObject),
6869}
6870
6871impl RcvConnEvent {
6872    pub fn make_switch_queue(phase: SwitchPhase) -> Self {
6873        Self::SwitchQueue {
6874            phase,
6875            undocumented: Default::default(),
6876        }
6877    }
6878
6879    pub fn make_ratchet_sync(sync_status: RatchetSyncState) -> Self {
6880        Self::RatchetSync {
6881            sync_status,
6882            undocumented: Default::default(),
6883        }
6884    }
6885
6886    pub fn make_verification_code_reset() -> Self {
6887        Self::VerificationCodeReset
6888    }
6889
6890    pub fn make_pq_enabled(enabled: bool) -> Self {
6891        Self::PqEnabled {
6892            enabled,
6893            undocumented: Default::default(),
6894        }
6895    }
6896}
6897
6898impl RcvConnEvent {
6899    pub fn switch_queue(&self) -> Option<&SwitchPhase> {
6900        if let Self::SwitchQueue { phase, .. } = self {
6901            Some(phase)
6902        } else {
6903            None
6904        }
6905    }
6906    pub fn ratchet_sync(&self) -> Option<&RatchetSyncState> {
6907        if let Self::RatchetSync { sync_status, .. } = self {
6908            Some(sync_status)
6909        } else {
6910            None
6911        }
6912    }
6913    pub fn is_verification_code_reset(&self) -> bool {
6914        matches!(self, Self::VerificationCodeReset)
6915    }
6916    pub fn pq_enabled(&self) -> Option<&bool> {
6917        if let Self::PqEnabled { enabled, .. } = self {
6918            Some(enabled)
6919        } else {
6920            None
6921        }
6922    }
6923}
6924
6925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6926#[serde(tag = "type")]
6927#[non_exhaustive]
6928pub enum RcvDirectEvent {
6929    #[serde(rename = "contactDeleted")]
6930    ContactDeleted,
6931    #[serde(rename = "profileUpdated")]
6932    ProfileUpdated {
6933        #[serde(rename = "fromProfile")]
6934        from_profile: Profile,
6935
6936        #[serde(rename = "toProfile")]
6937        to_profile: Profile,
6938
6939        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6940        undocumented: JsonObject,
6941    },
6942    #[serde(rename = "groupInvLinkReceived")]
6943    GroupInvLinkReceived {
6944        #[serde(rename = "groupProfile")]
6945        group_profile: GroupProfile,
6946
6947        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6948        undocumented: JsonObject,
6949    },
6950    #[serde(untagged)]
6951    Undocumented(JsonObject),
6952}
6953
6954impl RcvDirectEvent {
6955    pub fn make_contact_deleted() -> Self {
6956        Self::ContactDeleted
6957    }
6958
6959    pub fn make_profile_updated(from_profile: Profile, to_profile: Profile) -> Self {
6960        Self::ProfileUpdated {
6961            from_profile,
6962            to_profile,
6963            undocumented: Default::default(),
6964        }
6965    }
6966
6967    pub fn make_group_inv_link_received(group_profile: GroupProfile) -> Self {
6968        Self::GroupInvLinkReceived {
6969            group_profile,
6970            undocumented: Default::default(),
6971        }
6972    }
6973}
6974
6975impl RcvDirectEvent {
6976    pub fn is_contact_deleted(&self) -> bool {
6977        matches!(self, Self::ContactDeleted)
6978    }
6979    pub fn profile_updated(&self) -> Option<RcvDirectEventProfileUpdatedRef<'_>> {
6980        if let Self::ProfileUpdated {
6981            from_profile,
6982            to_profile,
6983            ..
6984        } = self
6985        {
6986            Some(RcvDirectEventProfileUpdatedRef {
6987                from_profile,
6988                to_profile,
6989            })
6990        } else {
6991            None
6992        }
6993    }
6994    pub fn group_inv_link_received(&self) -> Option<&GroupProfile> {
6995        if let Self::GroupInvLinkReceived { group_profile, .. } = self {
6996            Some(group_profile)
6997        } else {
6998            None
6999        }
7000    }
7001}
7002#[derive(Clone, Copy)]
7003pub struct RcvDirectEventProfileUpdatedRef<'a> {
7004    pub from_profile: &'a Profile,
7005    pub to_profile: &'a Profile,
7006}
7007
7008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7009#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7010#[cfg_attr(feature = "bon", builder(on(String, into)))]
7011pub struct RcvFileDescr {
7012    #[serde(
7013        rename = "fileDescrId",
7014        deserialize_with = "deserialize_number_from_string"
7015    )]
7016    pub file_descr_id: i64,
7017
7018    #[serde(rename = "fileDescrText")]
7019    pub file_descr_text: String,
7020
7021    #[serde(
7022        rename = "fileDescrPartNo",
7023        deserialize_with = "deserialize_number_from_string"
7024    )]
7025    pub file_descr_part_no: i32,
7026
7027    #[serde(rename = "fileDescrComplete", default)]
7028    pub file_descr_complete: bool,
7029
7030    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7031    #[cfg_attr(feature = "bon", builder(default))]
7032    pub undocumented: JsonObject,
7033}
7034
7035#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7036#[serde(tag = "type")]
7037#[non_exhaustive]
7038pub enum RcvFileStatus {
7039    #[serde(rename = "new")]
7040    New,
7041    #[serde(rename = "accepted")]
7042    Accepted {
7043        #[serde(rename = "filePath")]
7044        file_path: String,
7045
7046        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7047        undocumented: JsonObject,
7048    },
7049    #[serde(rename = "connected")]
7050    Connected {
7051        #[serde(rename = "filePath")]
7052        file_path: String,
7053
7054        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7055        undocumented: JsonObject,
7056    },
7057    #[serde(rename = "complete")]
7058    Complete {
7059        #[serde(rename = "filePath")]
7060        file_path: String,
7061
7062        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7063        undocumented: JsonObject,
7064    },
7065    #[serde(rename = "cancelled")]
7066    Cancelled {
7067        #[serde(rename = "filePath_", skip_serializing_if = "Option::is_none")]
7068        file_path: Option<String>,
7069
7070        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7071        undocumented: JsonObject,
7072    },
7073    #[serde(untagged)]
7074    Undocumented(JsonObject),
7075}
7076
7077impl RcvFileStatus {
7078    pub fn make_new() -> Self {
7079        Self::New
7080    }
7081
7082    pub fn make_accepted(file_path: String) -> Self {
7083        Self::Accepted {
7084            file_path,
7085            undocumented: Default::default(),
7086        }
7087    }
7088
7089    pub fn make_connected(file_path: String) -> Self {
7090        Self::Connected {
7091            file_path,
7092            undocumented: Default::default(),
7093        }
7094    }
7095
7096    pub fn make_complete(file_path: String) -> Self {
7097        Self::Complete {
7098            file_path,
7099            undocumented: Default::default(),
7100        }
7101    }
7102
7103    pub fn make_cancelled(file_path: Option<String>) -> Self {
7104        Self::Cancelled {
7105            file_path,
7106            undocumented: Default::default(),
7107        }
7108    }
7109}
7110
7111impl RcvFileStatus {
7112    pub fn is_new(&self) -> bool {
7113        matches!(self, Self::New)
7114    }
7115    pub fn accepted(&self) -> Option<&String> {
7116        if let Self::Accepted { file_path, .. } = self {
7117            Some(file_path)
7118        } else {
7119            None
7120        }
7121    }
7122    pub fn connected(&self) -> Option<&String> {
7123        if let Self::Connected { file_path, .. } = self {
7124            Some(file_path)
7125        } else {
7126            None
7127        }
7128    }
7129    pub fn complete(&self) -> Option<&String> {
7130        if let Self::Complete { file_path, .. } = self {
7131            Some(file_path)
7132        } else {
7133            None
7134        }
7135    }
7136    pub fn cancelled(&self) -> Option<&Option<String>> {
7137        if let Self::Cancelled { file_path, .. } = self {
7138            Some(file_path)
7139        } else {
7140            None
7141        }
7142    }
7143}
7144
7145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7146#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7147#[cfg_attr(feature = "bon", builder(on(String, into)))]
7148pub struct RcvFileTransfer {
7149    #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
7150    pub file_id: i64,
7151
7152    #[serde(rename = "xftpRcvFile", skip_serializing_if = "Option::is_none")]
7153    pub xftp_rcv_file: Option<XFTPRcvFile>,
7154
7155    #[serde(rename = "fileInvitation")]
7156    pub file_invitation: FileInvitation,
7157
7158    #[serde(rename = "fileStatus")]
7159    pub file_status: RcvFileStatus,
7160
7161    #[serde(rename = "rcvFileInline", skip_serializing_if = "Option::is_none")]
7162    pub rcv_file_inline: Option<InlineFileMode>,
7163
7164    #[serde(rename = "senderDisplayName")]
7165    pub sender_display_name: String,
7166
7167    #[serde(
7168        rename = "chunkSize",
7169        deserialize_with = "deserialize_number_from_string"
7170    )]
7171    pub chunk_size: i64,
7172
7173    #[serde(rename = "cancelled", default)]
7174    pub cancelled: bool,
7175
7176    #[serde(
7177        rename = "grpMemberId",
7178        skip_serializing_if = "Option::is_none",
7179        deserialize_with = "deserialize_option_number_from_string",
7180        default
7181    )]
7182    pub grp_member_id: Option<i64>,
7183
7184    #[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
7185    pub crypto_args: Option<CryptoFileArgs>,
7186
7187    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7188    #[cfg_attr(feature = "bon", builder(default))]
7189    pub undocumented: JsonObject,
7190}
7191
7192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7193#[serde(tag = "type")]
7194#[non_exhaustive]
7195pub enum RcvGroupEvent {
7196    #[serde(rename = "memberAdded")]
7197    MemberAdded {
7198        #[serde(
7199            rename = "groupMemberId",
7200            deserialize_with = "deserialize_number_from_string"
7201        )]
7202        group_member_id: i64,
7203
7204        #[serde(rename = "profile")]
7205        profile: Profile,
7206
7207        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7208        undocumented: JsonObject,
7209    },
7210    #[serde(rename = "memberConnected")]
7211    MemberConnected,
7212    #[serde(rename = "memberAccepted")]
7213    MemberAccepted {
7214        #[serde(
7215            rename = "groupMemberId",
7216            deserialize_with = "deserialize_number_from_string"
7217        )]
7218        group_member_id: i64,
7219
7220        #[serde(rename = "profile")]
7221        profile: Profile,
7222
7223        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7224        undocumented: JsonObject,
7225    },
7226    #[serde(rename = "userAccepted")]
7227    UserAccepted,
7228    #[serde(rename = "memberLeft")]
7229    MemberLeft,
7230    #[serde(rename = "memberRole")]
7231    MemberRole {
7232        #[serde(
7233            rename = "groupMemberId",
7234            deserialize_with = "deserialize_number_from_string"
7235        )]
7236        group_member_id: i64,
7237
7238        #[serde(rename = "profile")]
7239        profile: Profile,
7240
7241        #[serde(rename = "role")]
7242        role: GroupMemberRole,
7243
7244        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7245        undocumented: JsonObject,
7246    },
7247    #[serde(rename = "memberBlocked")]
7248    MemberBlocked {
7249        #[serde(
7250            rename = "groupMemberId",
7251            deserialize_with = "deserialize_number_from_string"
7252        )]
7253        group_member_id: i64,
7254
7255        #[serde(rename = "profile")]
7256        profile: Profile,
7257
7258        #[serde(rename = "blocked", default)]
7259        blocked: bool,
7260
7261        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7262        undocumented: JsonObject,
7263    },
7264    #[serde(rename = "userRole")]
7265    UserRole {
7266        #[serde(rename = "role")]
7267        role: GroupMemberRole,
7268
7269        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7270        undocumented: JsonObject,
7271    },
7272    #[serde(rename = "memberDeleted")]
7273    MemberDeleted {
7274        #[serde(
7275            rename = "groupMemberId",
7276            deserialize_with = "deserialize_number_from_string"
7277        )]
7278        group_member_id: i64,
7279
7280        #[serde(rename = "profile")]
7281        profile: Profile,
7282
7283        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7284        undocumented: JsonObject,
7285    },
7286    #[serde(rename = "userDeleted")]
7287    UserDeleted,
7288    #[serde(rename = "groupDeleted")]
7289    GroupDeleted,
7290    #[serde(rename = "groupUpdated")]
7291    GroupUpdated {
7292        #[serde(rename = "groupProfile")]
7293        group_profile: GroupProfile,
7294
7295        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7296        undocumented: JsonObject,
7297    },
7298    #[serde(rename = "invitedViaGroupLink")]
7299    InvitedViaGroupLink,
7300    #[serde(rename = "memberCreatedContact")]
7301    MemberCreatedContact,
7302    #[serde(rename = "memberProfileUpdated")]
7303    MemberProfileUpdated {
7304        #[serde(rename = "fromProfile")]
7305        from_profile: Profile,
7306
7307        #[serde(rename = "toProfile")]
7308        to_profile: Profile,
7309
7310        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7311        undocumented: JsonObject,
7312    },
7313    #[serde(rename = "newMemberPendingReview")]
7314    NewMemberPendingReview,
7315    #[serde(rename = "msgBadSignature")]
7316    MsgBadSignature,
7317    #[serde(untagged)]
7318    Undocumented(JsonObject),
7319}
7320
7321impl RcvGroupEvent {
7322    pub fn make_member_added(group_member_id: i64, profile: Profile) -> Self {
7323        Self::MemberAdded {
7324            group_member_id,
7325            profile,
7326            undocumented: Default::default(),
7327        }
7328    }
7329
7330    pub fn make_member_connected() -> Self {
7331        Self::MemberConnected
7332    }
7333
7334    pub fn make_member_accepted(group_member_id: i64, profile: Profile) -> Self {
7335        Self::MemberAccepted {
7336            group_member_id,
7337            profile,
7338            undocumented: Default::default(),
7339        }
7340    }
7341
7342    pub fn make_user_accepted() -> Self {
7343        Self::UserAccepted
7344    }
7345
7346    pub fn make_member_left() -> Self {
7347        Self::MemberLeft
7348    }
7349
7350    pub fn make_member_role(group_member_id: i64, profile: Profile, role: GroupMemberRole) -> Self {
7351        Self::MemberRole {
7352            group_member_id,
7353            profile,
7354            role,
7355            undocumented: Default::default(),
7356        }
7357    }
7358
7359    pub fn make_member_blocked(group_member_id: i64, profile: Profile, blocked: bool) -> Self {
7360        Self::MemberBlocked {
7361            group_member_id,
7362            profile,
7363            blocked,
7364            undocumented: Default::default(),
7365        }
7366    }
7367
7368    pub fn make_user_role(role: GroupMemberRole) -> Self {
7369        Self::UserRole {
7370            role,
7371            undocumented: Default::default(),
7372        }
7373    }
7374
7375    pub fn make_member_deleted(group_member_id: i64, profile: Profile) -> Self {
7376        Self::MemberDeleted {
7377            group_member_id,
7378            profile,
7379            undocumented: Default::default(),
7380        }
7381    }
7382
7383    pub fn make_user_deleted() -> Self {
7384        Self::UserDeleted
7385    }
7386
7387    pub fn make_group_deleted() -> Self {
7388        Self::GroupDeleted
7389    }
7390
7391    pub fn make_group_updated(group_profile: GroupProfile) -> Self {
7392        Self::GroupUpdated {
7393            group_profile,
7394            undocumented: Default::default(),
7395        }
7396    }
7397
7398    pub fn make_invited_via_group_link() -> Self {
7399        Self::InvitedViaGroupLink
7400    }
7401
7402    pub fn make_member_created_contact() -> Self {
7403        Self::MemberCreatedContact
7404    }
7405
7406    pub fn make_member_profile_updated(from_profile: Profile, to_profile: Profile) -> Self {
7407        Self::MemberProfileUpdated {
7408            from_profile,
7409            to_profile,
7410            undocumented: Default::default(),
7411        }
7412    }
7413
7414    pub fn make_new_member_pending_review() -> Self {
7415        Self::NewMemberPendingReview
7416    }
7417
7418    pub fn make_msg_bad_signature() -> Self {
7419        Self::MsgBadSignature
7420    }
7421}
7422
7423impl RcvGroupEvent {
7424    pub fn member_added(&self) -> Option<RcvGroupEventMemberAddedRef<'_>> {
7425        if let Self::MemberAdded {
7426            group_member_id,
7427            profile,
7428            ..
7429        } = self
7430        {
7431            Some(RcvGroupEventMemberAddedRef {
7432                group_member_id,
7433                profile,
7434            })
7435        } else {
7436            None
7437        }
7438    }
7439    pub fn is_member_connected(&self) -> bool {
7440        matches!(self, Self::MemberConnected)
7441    }
7442    pub fn member_accepted(&self) -> Option<RcvGroupEventMemberAcceptedRef<'_>> {
7443        if let Self::MemberAccepted {
7444            group_member_id,
7445            profile,
7446            ..
7447        } = self
7448        {
7449            Some(RcvGroupEventMemberAcceptedRef {
7450                group_member_id,
7451                profile,
7452            })
7453        } else {
7454            None
7455        }
7456    }
7457    pub fn is_user_accepted(&self) -> bool {
7458        matches!(self, Self::UserAccepted)
7459    }
7460    pub fn is_member_left(&self) -> bool {
7461        matches!(self, Self::MemberLeft)
7462    }
7463    pub fn member_role(&self) -> Option<RcvGroupEventMemberRoleRef<'_>> {
7464        if let Self::MemberRole {
7465            group_member_id,
7466            profile,
7467            role,
7468            ..
7469        } = self
7470        {
7471            Some(RcvGroupEventMemberRoleRef {
7472                group_member_id,
7473                profile,
7474                role,
7475            })
7476        } else {
7477            None
7478        }
7479    }
7480    pub fn member_blocked(&self) -> Option<RcvGroupEventMemberBlockedRef<'_>> {
7481        if let Self::MemberBlocked {
7482            group_member_id,
7483            profile,
7484            blocked,
7485            ..
7486        } = self
7487        {
7488            Some(RcvGroupEventMemberBlockedRef {
7489                group_member_id,
7490                profile,
7491                blocked,
7492            })
7493        } else {
7494            None
7495        }
7496    }
7497    pub fn user_role(&self) -> Option<&GroupMemberRole> {
7498        if let Self::UserRole { role, .. } = self {
7499            Some(role)
7500        } else {
7501            None
7502        }
7503    }
7504    pub fn member_deleted(&self) -> Option<RcvGroupEventMemberDeletedRef<'_>> {
7505        if let Self::MemberDeleted {
7506            group_member_id,
7507            profile,
7508            ..
7509        } = self
7510        {
7511            Some(RcvGroupEventMemberDeletedRef {
7512                group_member_id,
7513                profile,
7514            })
7515        } else {
7516            None
7517        }
7518    }
7519    pub fn is_user_deleted(&self) -> bool {
7520        matches!(self, Self::UserDeleted)
7521    }
7522    pub fn is_group_deleted(&self) -> bool {
7523        matches!(self, Self::GroupDeleted)
7524    }
7525    pub fn group_updated(&self) -> Option<&GroupProfile> {
7526        if let Self::GroupUpdated { group_profile, .. } = self {
7527            Some(group_profile)
7528        } else {
7529            None
7530        }
7531    }
7532    pub fn is_invited_via_group_link(&self) -> bool {
7533        matches!(self, Self::InvitedViaGroupLink)
7534    }
7535    pub fn is_member_created_contact(&self) -> bool {
7536        matches!(self, Self::MemberCreatedContact)
7537    }
7538    pub fn member_profile_updated(&self) -> Option<RcvGroupEventMemberProfileUpdatedRef<'_>> {
7539        if let Self::MemberProfileUpdated {
7540            from_profile,
7541            to_profile,
7542            ..
7543        } = self
7544        {
7545            Some(RcvGroupEventMemberProfileUpdatedRef {
7546                from_profile,
7547                to_profile,
7548            })
7549        } else {
7550            None
7551        }
7552    }
7553    pub fn is_new_member_pending_review(&self) -> bool {
7554        matches!(self, Self::NewMemberPendingReview)
7555    }
7556    pub fn is_msg_bad_signature(&self) -> bool {
7557        matches!(self, Self::MsgBadSignature)
7558    }
7559}
7560#[derive(Clone, Copy)]
7561pub struct RcvGroupEventMemberAddedRef<'a> {
7562    pub group_member_id: &'a i64,
7563    pub profile: &'a Profile,
7564}
7565#[derive(Clone, Copy)]
7566pub struct RcvGroupEventMemberAcceptedRef<'a> {
7567    pub group_member_id: &'a i64,
7568    pub profile: &'a Profile,
7569}
7570#[derive(Clone, Copy)]
7571pub struct RcvGroupEventMemberRoleRef<'a> {
7572    pub group_member_id: &'a i64,
7573    pub profile: &'a Profile,
7574    pub role: &'a GroupMemberRole,
7575}
7576#[derive(Clone, Copy)]
7577pub struct RcvGroupEventMemberBlockedRef<'a> {
7578    pub group_member_id: &'a i64,
7579    pub profile: &'a Profile,
7580    pub blocked: &'a bool,
7581}
7582#[derive(Clone, Copy)]
7583pub struct RcvGroupEventMemberDeletedRef<'a> {
7584    pub group_member_id: &'a i64,
7585    pub profile: &'a Profile,
7586}
7587#[derive(Clone, Copy)]
7588pub struct RcvGroupEventMemberProfileUpdatedRef<'a> {
7589    pub from_profile: &'a Profile,
7590    pub to_profile: &'a Profile,
7591}
7592
7593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7594#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7595#[cfg_attr(feature = "bon", builder(on(String, into)))]
7596pub struct RelayProfile {
7597    #[serde(rename = "displayName")]
7598    pub display_name: String,
7599
7600    #[serde(rename = "fullName")]
7601    pub full_name: String,
7602
7603    #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
7604    pub short_descr: Option<String>,
7605
7606    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
7607    pub image: Option<String>,
7608
7609    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7610    #[cfg_attr(feature = "bon", builder(default))]
7611    pub undocumented: JsonObject,
7612}
7613
7614#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7615#[non_exhaustive]
7616pub enum RelayStatus {
7617    #[default]
7618    #[serde(rename = "new")]
7619    New,
7620    #[serde(rename = "invited")]
7621    Invited,
7622    #[serde(rename = "accepted")]
7623    Accepted,
7624    #[serde(rename = "active")]
7625    Active,
7626    #[serde(rename = "inactive")]
7627    Inactive,
7628}
7629
7630#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7631#[non_exhaustive]
7632pub enum ReportReason {
7633    #[default]
7634    #[serde(rename = "spam")]
7635    Spam,
7636    #[serde(rename = "content")]
7637    Content,
7638    #[serde(rename = "community")]
7639    Community,
7640    #[serde(rename = "profile")]
7641    Profile,
7642    #[serde(rename = "other")]
7643    Other,
7644}
7645
7646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7647#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7648#[cfg_attr(feature = "bon", builder(on(String, into)))]
7649pub struct RoleGroupPreference {
7650    #[serde(rename = "enable")]
7651    pub enable: GroupFeatureEnabled,
7652
7653    #[serde(rename = "role", skip_serializing_if = "Option::is_none")]
7654    pub role: Option<GroupMemberRole>,
7655
7656    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7657    #[cfg_attr(feature = "bon", builder(default))]
7658    pub undocumented: JsonObject,
7659}
7660
7661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7662#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7663#[cfg_attr(feature = "bon", builder(on(String, into)))]
7664pub struct SecurityCode {
7665    #[serde(rename = "securityCode")]
7666    pub security_code: String,
7667
7668    #[serde(rename = "verifiedAt")]
7669    pub verified_at: UtcTime,
7670
7671    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7672    #[cfg_attr(feature = "bon", builder(default))]
7673    pub undocumented: JsonObject,
7674}
7675
7676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7677#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7678#[cfg_attr(feature = "bon", builder(on(String, into)))]
7679pub struct SimplePreference {
7680    #[serde(rename = "allow")]
7681    pub allow: FeatureAllowed,
7682
7683    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7684    #[cfg_attr(feature = "bon", builder(default))]
7685    pub undocumented: JsonObject,
7686}
7687
7688#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7689#[non_exhaustive]
7690pub enum SimplexLinkType {
7691    #[default]
7692    #[serde(rename = "contact")]
7693    Contact,
7694    #[serde(rename = "invitation")]
7695    Invitation,
7696    #[serde(rename = "group")]
7697    Group,
7698    #[serde(rename = "channel")]
7699    Channel,
7700    #[serde(rename = "relay")]
7701    Relay,
7702}
7703
7704#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7705#[non_exhaustive]
7706pub enum SndCIStatusProgress {
7707    #[default]
7708    #[serde(rename = "partial")]
7709    Partial,
7710    #[serde(rename = "complete")]
7711    Complete,
7712}
7713
7714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7715#[serde(tag = "type")]
7716#[non_exhaustive]
7717pub enum SndConnEvent {
7718    #[serde(rename = "switchQueue")]
7719    SwitchQueue {
7720        #[serde(rename = "phase")]
7721        phase: SwitchPhase,
7722
7723        #[serde(rename = "member", skip_serializing_if = "Option::is_none")]
7724        member: Option<GroupMemberRef>,
7725
7726        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7727        undocumented: JsonObject,
7728    },
7729    #[serde(rename = "ratchetSync")]
7730    RatchetSync {
7731        #[serde(rename = "syncStatus")]
7732        sync_status: RatchetSyncState,
7733
7734        #[serde(rename = "member", skip_serializing_if = "Option::is_none")]
7735        member: Option<GroupMemberRef>,
7736
7737        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7738        undocumented: JsonObject,
7739    },
7740    #[serde(rename = "pqEnabled")]
7741    PqEnabled {
7742        #[serde(rename = "enabled", default)]
7743        enabled: bool,
7744
7745        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7746        undocumented: JsonObject,
7747    },
7748    #[serde(untagged)]
7749    Undocumented(JsonObject),
7750}
7751
7752impl SndConnEvent {
7753    pub fn make_switch_queue(phase: SwitchPhase, member: Option<GroupMemberRef>) -> Self {
7754        Self::SwitchQueue {
7755            phase,
7756            member,
7757            undocumented: Default::default(),
7758        }
7759    }
7760
7761    pub fn make_ratchet_sync(
7762        sync_status: RatchetSyncState,
7763        member: Option<GroupMemberRef>,
7764    ) -> Self {
7765        Self::RatchetSync {
7766            sync_status,
7767            member,
7768            undocumented: Default::default(),
7769        }
7770    }
7771
7772    pub fn make_pq_enabled(enabled: bool) -> Self {
7773        Self::PqEnabled {
7774            enabled,
7775            undocumented: Default::default(),
7776        }
7777    }
7778}
7779
7780impl SndConnEvent {
7781    pub fn switch_queue(&self) -> Option<SndConnEventSwitchQueueRef<'_>> {
7782        if let Self::SwitchQueue { phase, member, .. } = self {
7783            Some(SndConnEventSwitchQueueRef { phase, member })
7784        } else {
7785            None
7786        }
7787    }
7788    pub fn ratchet_sync(&self) -> Option<SndConnEventRatchetSyncRef<'_>> {
7789        if let Self::RatchetSync {
7790            sync_status,
7791            member,
7792            ..
7793        } = self
7794        {
7795            Some(SndConnEventRatchetSyncRef {
7796                sync_status,
7797                member,
7798            })
7799        } else {
7800            None
7801        }
7802    }
7803    pub fn pq_enabled(&self) -> Option<&bool> {
7804        if let Self::PqEnabled { enabled, .. } = self {
7805            Some(enabled)
7806        } else {
7807            None
7808        }
7809    }
7810}
7811#[derive(Clone, Copy)]
7812pub struct SndConnEventSwitchQueueRef<'a> {
7813    pub phase: &'a SwitchPhase,
7814    pub member: &'a Option<GroupMemberRef>,
7815}
7816#[derive(Clone, Copy)]
7817pub struct SndConnEventRatchetSyncRef<'a> {
7818    pub sync_status: &'a RatchetSyncState,
7819    pub member: &'a Option<GroupMemberRef>,
7820}
7821
7822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7823#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7824#[cfg_attr(feature = "bon", builder(on(String, into)))]
7825pub struct SndFileTransfer {
7826    #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
7827    pub file_id: i64,
7828
7829    #[serde(rename = "fileName")]
7830    pub file_name: String,
7831
7832    #[serde(rename = "filePath")]
7833    pub file_path: String,
7834
7835    #[serde(
7836        rename = "fileSize",
7837        deserialize_with = "deserialize_number_from_string"
7838    )]
7839    pub file_size: i64,
7840
7841    #[serde(
7842        rename = "chunkSize",
7843        deserialize_with = "deserialize_number_from_string"
7844    )]
7845    pub chunk_size: i64,
7846
7847    #[serde(rename = "recipientDisplayName")]
7848    pub recipient_display_name: String,
7849
7850    #[serde(rename = "connId", deserialize_with = "deserialize_number_from_string")]
7851    pub conn_id: i64,
7852
7853    #[serde(rename = "agentConnId")]
7854    pub agent_conn_id: String,
7855
7856    #[serde(
7857        rename = "groupMemberId",
7858        skip_serializing_if = "Option::is_none",
7859        deserialize_with = "deserialize_option_number_from_string",
7860        default
7861    )]
7862    pub group_member_id: Option<i64>,
7863
7864    #[serde(rename = "fileStatus")]
7865    pub file_status: FileStatus,
7866
7867    #[serde(
7868        rename = "fileDescrId",
7869        skip_serializing_if = "Option::is_none",
7870        deserialize_with = "deserialize_option_number_from_string",
7871        default
7872    )]
7873    pub file_descr_id: Option<i64>,
7874
7875    #[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
7876    pub file_inline: Option<InlineFileMode>,
7877
7878    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7879    #[cfg_attr(feature = "bon", builder(default))]
7880    pub undocumented: JsonObject,
7881}
7882
7883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7884#[serde(tag = "type")]
7885#[non_exhaustive]
7886pub enum SndGroupEvent {
7887    #[serde(rename = "memberRole")]
7888    MemberRole {
7889        #[serde(
7890            rename = "groupMemberId",
7891            deserialize_with = "deserialize_number_from_string"
7892        )]
7893        group_member_id: i64,
7894
7895        #[serde(rename = "profile")]
7896        profile: Profile,
7897
7898        #[serde(rename = "role")]
7899        role: GroupMemberRole,
7900
7901        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7902        undocumented: JsonObject,
7903    },
7904    #[serde(rename = "memberBlocked")]
7905    MemberBlocked {
7906        #[serde(
7907            rename = "groupMemberId",
7908            deserialize_with = "deserialize_number_from_string"
7909        )]
7910        group_member_id: i64,
7911
7912        #[serde(rename = "profile")]
7913        profile: Profile,
7914
7915        #[serde(rename = "blocked", default)]
7916        blocked: bool,
7917
7918        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7919        undocumented: JsonObject,
7920    },
7921    #[serde(rename = "userRole")]
7922    UserRole {
7923        #[serde(rename = "role")]
7924        role: GroupMemberRole,
7925
7926        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7927        undocumented: JsonObject,
7928    },
7929    #[serde(rename = "memberDeleted")]
7930    MemberDeleted {
7931        #[serde(
7932            rename = "groupMemberId",
7933            deserialize_with = "deserialize_number_from_string"
7934        )]
7935        group_member_id: i64,
7936
7937        #[serde(rename = "profile")]
7938        profile: Profile,
7939
7940        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7941        undocumented: JsonObject,
7942    },
7943    #[serde(rename = "userLeft")]
7944    UserLeft,
7945    #[serde(rename = "groupUpdated")]
7946    GroupUpdated {
7947        #[serde(rename = "groupProfile")]
7948        group_profile: GroupProfile,
7949
7950        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7951        undocumented: JsonObject,
7952    },
7953    #[serde(rename = "memberAccepted")]
7954    MemberAccepted {
7955        #[serde(
7956            rename = "groupMemberId",
7957            deserialize_with = "deserialize_number_from_string"
7958        )]
7959        group_member_id: i64,
7960
7961        #[serde(rename = "profile")]
7962        profile: Profile,
7963
7964        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7965        undocumented: JsonObject,
7966    },
7967    #[serde(rename = "userPendingReview")]
7968    UserPendingReview,
7969    #[serde(untagged)]
7970    Undocumented(JsonObject),
7971}
7972
7973impl SndGroupEvent {
7974    pub fn make_member_role(group_member_id: i64, profile: Profile, role: GroupMemberRole) -> Self {
7975        Self::MemberRole {
7976            group_member_id,
7977            profile,
7978            role,
7979            undocumented: Default::default(),
7980        }
7981    }
7982
7983    pub fn make_member_blocked(group_member_id: i64, profile: Profile, blocked: bool) -> Self {
7984        Self::MemberBlocked {
7985            group_member_id,
7986            profile,
7987            blocked,
7988            undocumented: Default::default(),
7989        }
7990    }
7991
7992    pub fn make_user_role(role: GroupMemberRole) -> Self {
7993        Self::UserRole {
7994            role,
7995            undocumented: Default::default(),
7996        }
7997    }
7998
7999    pub fn make_member_deleted(group_member_id: i64, profile: Profile) -> Self {
8000        Self::MemberDeleted {
8001            group_member_id,
8002            profile,
8003            undocumented: Default::default(),
8004        }
8005    }
8006
8007    pub fn make_user_left() -> Self {
8008        Self::UserLeft
8009    }
8010
8011    pub fn make_group_updated(group_profile: GroupProfile) -> Self {
8012        Self::GroupUpdated {
8013            group_profile,
8014            undocumented: Default::default(),
8015        }
8016    }
8017
8018    pub fn make_member_accepted(group_member_id: i64, profile: Profile) -> Self {
8019        Self::MemberAccepted {
8020            group_member_id,
8021            profile,
8022            undocumented: Default::default(),
8023        }
8024    }
8025
8026    pub fn make_user_pending_review() -> Self {
8027        Self::UserPendingReview
8028    }
8029}
8030
8031impl SndGroupEvent {
8032    pub fn member_role(&self) -> Option<SndGroupEventMemberRoleRef<'_>> {
8033        if let Self::MemberRole {
8034            group_member_id,
8035            profile,
8036            role,
8037            ..
8038        } = self
8039        {
8040            Some(SndGroupEventMemberRoleRef {
8041                group_member_id,
8042                profile,
8043                role,
8044            })
8045        } else {
8046            None
8047        }
8048    }
8049    pub fn member_blocked(&self) -> Option<SndGroupEventMemberBlockedRef<'_>> {
8050        if let Self::MemberBlocked {
8051            group_member_id,
8052            profile,
8053            blocked,
8054            ..
8055        } = self
8056        {
8057            Some(SndGroupEventMemberBlockedRef {
8058                group_member_id,
8059                profile,
8060                blocked,
8061            })
8062        } else {
8063            None
8064        }
8065    }
8066    pub fn user_role(&self) -> Option<&GroupMemberRole> {
8067        if let Self::UserRole { role, .. } = self {
8068            Some(role)
8069        } else {
8070            None
8071        }
8072    }
8073    pub fn member_deleted(&self) -> Option<SndGroupEventMemberDeletedRef<'_>> {
8074        if let Self::MemberDeleted {
8075            group_member_id,
8076            profile,
8077            ..
8078        } = self
8079        {
8080            Some(SndGroupEventMemberDeletedRef {
8081                group_member_id,
8082                profile,
8083            })
8084        } else {
8085            None
8086        }
8087    }
8088    pub fn is_user_left(&self) -> bool {
8089        matches!(self, Self::UserLeft)
8090    }
8091    pub fn group_updated(&self) -> Option<&GroupProfile> {
8092        if let Self::GroupUpdated { group_profile, .. } = self {
8093            Some(group_profile)
8094        } else {
8095            None
8096        }
8097    }
8098    pub fn member_accepted(&self) -> Option<SndGroupEventMemberAcceptedRef<'_>> {
8099        if let Self::MemberAccepted {
8100            group_member_id,
8101            profile,
8102            ..
8103        } = self
8104        {
8105            Some(SndGroupEventMemberAcceptedRef {
8106                group_member_id,
8107                profile,
8108            })
8109        } else {
8110            None
8111        }
8112    }
8113    pub fn is_user_pending_review(&self) -> bool {
8114        matches!(self, Self::UserPendingReview)
8115    }
8116}
8117#[derive(Clone, Copy)]
8118pub struct SndGroupEventMemberRoleRef<'a> {
8119    pub group_member_id: &'a i64,
8120    pub profile: &'a Profile,
8121    pub role: &'a GroupMemberRole,
8122}
8123#[derive(Clone, Copy)]
8124pub struct SndGroupEventMemberBlockedRef<'a> {
8125    pub group_member_id: &'a i64,
8126    pub profile: &'a Profile,
8127    pub blocked: &'a bool,
8128}
8129#[derive(Clone, Copy)]
8130pub struct SndGroupEventMemberDeletedRef<'a> {
8131    pub group_member_id: &'a i64,
8132    pub profile: &'a Profile,
8133}
8134#[derive(Clone, Copy)]
8135pub struct SndGroupEventMemberAcceptedRef<'a> {
8136    pub group_member_id: &'a i64,
8137    pub profile: &'a Profile,
8138}
8139
8140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8141#[serde(tag = "type")]
8142#[non_exhaustive]
8143pub enum SubscriptionStatus {
8144    #[serde(rename = "active")]
8145    Active,
8146    #[serde(rename = "pending")]
8147    Pending,
8148    #[serde(rename = "removed")]
8149    Removed {
8150        #[serde(rename = "subError")]
8151        sub_error: String,
8152
8153        #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8154        undocumented: JsonObject,
8155    },
8156    #[serde(rename = "noSub")]
8157    NoSub,
8158    #[serde(untagged)]
8159    Undocumented(JsonObject),
8160}
8161
8162impl SubscriptionStatus {
8163    pub fn make_active() -> Self {
8164        Self::Active
8165    }
8166
8167    pub fn make_pending() -> Self {
8168        Self::Pending
8169    }
8170
8171    pub fn make_removed(sub_error: String) -> Self {
8172        Self::Removed {
8173            sub_error,
8174            undocumented: Default::default(),
8175        }
8176    }
8177
8178    pub fn make_no_sub() -> Self {
8179        Self::NoSub
8180    }
8181}
8182
8183impl SubscriptionStatus {
8184    pub fn is_active(&self) -> bool {
8185        matches!(self, Self::Active)
8186    }
8187    pub fn is_pending(&self) -> bool {
8188        matches!(self, Self::Pending)
8189    }
8190    pub fn removed(&self) -> Option<&String> {
8191        if let Self::Removed { sub_error, .. } = self {
8192            Some(sub_error)
8193        } else {
8194            None
8195        }
8196    }
8197    pub fn is_no_sub(&self) -> bool {
8198        matches!(self, Self::NoSub)
8199    }
8200}
8201
8202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8203#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8204#[cfg_attr(feature = "bon", builder(on(String, into)))]
8205pub struct SupportGroupPreference {
8206    #[serde(rename = "enable")]
8207    pub enable: GroupFeatureEnabled,
8208
8209    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8210    #[cfg_attr(feature = "bon", builder(default))]
8211    pub undocumented: JsonObject,
8212}
8213
8214#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
8215#[non_exhaustive]
8216pub enum SwitchPhase {
8217    #[default]
8218    #[serde(rename = "started")]
8219    Started,
8220    #[serde(rename = "confirmed")]
8221    Confirmed,
8222    #[serde(rename = "secured")]
8223    Secured,
8224    #[serde(rename = "completed")]
8225    Completed,
8226}
8227
8228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8229#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8230#[cfg_attr(feature = "bon", builder(on(String, into)))]
8231pub struct TimedMessagesGroupPreference {
8232    #[serde(rename = "enable")]
8233    pub enable: GroupFeatureEnabled,
8234
8235    #[serde(
8236        rename = "ttl",
8237        skip_serializing_if = "Option::is_none",
8238        deserialize_with = "deserialize_option_number_from_string",
8239        default
8240    )]
8241    pub ttl: Option<i32>,
8242
8243    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8244    #[cfg_attr(feature = "bon", builder(default))]
8245    pub undocumented: JsonObject,
8246}
8247
8248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8249#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8250#[cfg_attr(feature = "bon", builder(on(String, into)))]
8251pub struct TimedMessagesPreference {
8252    #[serde(rename = "allow")]
8253    pub allow: FeatureAllowed,
8254
8255    #[serde(
8256        rename = "ttl",
8257        skip_serializing_if = "Option::is_none",
8258        deserialize_with = "deserialize_option_number_from_string",
8259        default
8260    )]
8261    pub ttl: Option<i32>,
8262
8263    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8264    #[cfg_attr(feature = "bon", builder(default))]
8265    pub undocumented: JsonObject,
8266}
8267
8268#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
8269#[non_exhaustive]
8270pub enum UIColorMode {
8271    #[default]
8272    #[serde(rename = "light")]
8273    Light,
8274    #[serde(rename = "dark")]
8275    Dark,
8276}
8277
8278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8279#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8280#[cfg_attr(feature = "bon", builder(on(String, into)))]
8281pub struct UIColors {
8282    #[serde(rename = "accent", skip_serializing_if = "Option::is_none")]
8283    pub accent: Option<String>,
8284
8285    #[serde(rename = "accentVariant", skip_serializing_if = "Option::is_none")]
8286    pub accent_variant: Option<String>,
8287
8288    #[serde(rename = "secondary", skip_serializing_if = "Option::is_none")]
8289    pub secondary: Option<String>,
8290
8291    #[serde(rename = "secondaryVariant", skip_serializing_if = "Option::is_none")]
8292    pub secondary_variant: Option<String>,
8293
8294    #[serde(rename = "background", skip_serializing_if = "Option::is_none")]
8295    pub background: Option<String>,
8296
8297    #[serde(rename = "menus", skip_serializing_if = "Option::is_none")]
8298    pub menus: Option<String>,
8299
8300    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
8301    pub title: Option<String>,
8302
8303    #[serde(rename = "accentVariant2", skip_serializing_if = "Option::is_none")]
8304    pub accent_variant_2: Option<String>,
8305
8306    #[serde(rename = "sentMessage", skip_serializing_if = "Option::is_none")]
8307    pub sent_message: Option<String>,
8308
8309    #[serde(rename = "sentReply", skip_serializing_if = "Option::is_none")]
8310    pub sent_reply: Option<String>,
8311
8312    #[serde(rename = "receivedMessage", skip_serializing_if = "Option::is_none")]
8313    pub received_message: Option<String>,
8314
8315    #[serde(rename = "receivedReply", skip_serializing_if = "Option::is_none")]
8316    pub received_reply: Option<String>,
8317
8318    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8319    #[cfg_attr(feature = "bon", builder(default))]
8320    pub undocumented: JsonObject,
8321}
8322
8323#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8324#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8325#[cfg_attr(feature = "bon", builder(on(String, into)))]
8326pub struct UIThemeEntityOverride {
8327    #[serde(rename = "mode")]
8328    pub mode: UIColorMode,
8329
8330    #[serde(rename = "wallpaper", skip_serializing_if = "Option::is_none")]
8331    pub wallpaper: Option<ChatWallpaper>,
8332
8333    #[serde(rename = "colors")]
8334    pub colors: UIColors,
8335
8336    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8337    #[cfg_attr(feature = "bon", builder(default))]
8338    pub undocumented: JsonObject,
8339}
8340
8341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8342#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8343#[cfg_attr(feature = "bon", builder(on(String, into)))]
8344pub struct UIThemeEntityOverrides {
8345    #[serde(rename = "light", skip_serializing_if = "Option::is_none")]
8346    pub light: Option<UIThemeEntityOverride>,
8347
8348    #[serde(rename = "dark", skip_serializing_if = "Option::is_none")]
8349    pub dark: Option<UIThemeEntityOverride>,
8350
8351    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8352    #[cfg_attr(feature = "bon", builder(default))]
8353    pub undocumented: JsonObject,
8354}
8355
8356#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8357#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8358#[cfg_attr(feature = "bon", builder(on(String, into)))]
8359pub struct UpdatedMessage {
8360    #[serde(rename = "msgContent")]
8361    pub msg_content: MsgContent,
8362
8363    #[serde(rename = "mentions")]
8364    pub mentions: BTreeMap<String, i64>,
8365
8366    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8367    #[cfg_attr(feature = "bon", builder(default))]
8368    pub undocumented: JsonObject,
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 User {
8375    #[serde(rename = "userId", deserialize_with = "deserialize_number_from_string")]
8376    pub user_id: i64,
8377
8378    #[serde(
8379        rename = "agentUserId",
8380        deserialize_with = "deserialize_number_from_string"
8381    )]
8382    pub agent_user_id: i64,
8383
8384    #[serde(
8385        rename = "userContactId",
8386        deserialize_with = "deserialize_number_from_string"
8387    )]
8388    pub user_contact_id: i64,
8389
8390    #[serde(rename = "localDisplayName")]
8391    pub local_display_name: String,
8392
8393    #[serde(rename = "profile")]
8394    pub profile: LocalProfile,
8395
8396    #[serde(rename = "fullPreferences")]
8397    pub full_preferences: FullPreferences,
8398
8399    #[serde(rename = "activeUser", default)]
8400    pub active_user: bool,
8401
8402    #[serde(
8403        rename = "activeOrder",
8404        deserialize_with = "deserialize_number_from_string"
8405    )]
8406    pub active_order: i64,
8407
8408    #[serde(rename = "viewPwdHash", skip_serializing_if = "Option::is_none")]
8409    pub view_pwd_hash: Option<UserPwdHash>,
8410
8411    #[serde(rename = "showNtfs", default)]
8412    pub show_ntfs: bool,
8413
8414    #[serde(rename = "sendRcptsContacts", default)]
8415    pub send_rcpts_contacts: bool,
8416
8417    #[serde(rename = "sendRcptsSmallGroups", default)]
8418    pub send_rcpts_small_groups: bool,
8419
8420    #[serde(rename = "autoAcceptMemberContacts", default)]
8421    pub auto_accept_member_contacts: bool,
8422
8423    #[serde(
8424        rename = "userMemberProfileUpdatedAt",
8425        skip_serializing_if = "Option::is_none"
8426    )]
8427    pub user_member_profile_updated_at: Option<UtcTime>,
8428
8429    #[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
8430    pub ui_themes: Option<UIThemeEntityOverrides>,
8431
8432    #[serde(rename = "userChatRelay", default)]
8433    pub user_chat_relay: bool,
8434
8435    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8436    #[cfg_attr(feature = "bon", builder(default))]
8437    pub undocumented: JsonObject,
8438}
8439
8440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8441#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8442#[cfg_attr(feature = "bon", builder(on(String, into)))]
8443pub struct UserChatRelay {
8444    #[serde(
8445        rename = "chatRelayId",
8446        deserialize_with = "deserialize_number_from_string"
8447    )]
8448    pub chat_relay_id: i64,
8449
8450    #[serde(rename = "address")]
8451    pub address: String,
8452
8453    #[serde(rename = "relayProfile")]
8454    pub relay_profile: RelayProfile,
8455
8456    #[serde(rename = "domains")]
8457    pub domains: Vec<String>,
8458
8459    #[serde(rename = "preset", default)]
8460    pub preset: bool,
8461
8462    #[serde(rename = "tested", skip_serializing_if = "Option::is_none")]
8463    pub tested: Option<bool>,
8464
8465    #[serde(rename = "enabled", default)]
8466    pub enabled: bool,
8467
8468    #[serde(rename = "deleted", default)]
8469    pub deleted: bool,
8470
8471    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8472    #[cfg_attr(feature = "bon", builder(default))]
8473    pub undocumented: JsonObject,
8474}
8475
8476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8477#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8478#[cfg_attr(feature = "bon", builder(on(String, into)))]
8479pub struct UserContact {
8480    #[serde(
8481        rename = "userContactLinkId",
8482        deserialize_with = "deserialize_number_from_string"
8483    )]
8484    pub user_contact_link_id: i64,
8485
8486    #[serde(rename = "connReqContact")]
8487    pub conn_req_contact: String,
8488
8489    #[serde(
8490        rename = "groupId",
8491        skip_serializing_if = "Option::is_none",
8492        deserialize_with = "deserialize_option_number_from_string",
8493        default
8494    )]
8495    pub group_id: Option<i64>,
8496
8497    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8498    #[cfg_attr(feature = "bon", builder(default))]
8499    pub undocumented: JsonObject,
8500}
8501
8502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8503#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8504#[cfg_attr(feature = "bon", builder(on(String, into)))]
8505pub struct UserContactLink {
8506    #[serde(
8507        rename = "userContactLinkId",
8508        deserialize_with = "deserialize_number_from_string"
8509    )]
8510    pub user_contact_link_id: i64,
8511
8512    #[serde(rename = "connLinkContact")]
8513    pub conn_link_contact: CreatedConnLink,
8514
8515    #[serde(rename = "shortLinkDataSet", default)]
8516    pub short_link_data_set: bool,
8517
8518    #[serde(rename = "shortLinkLargeDataSet", default)]
8519    pub short_link_large_data_set: bool,
8520
8521    #[serde(rename = "addressSettings")]
8522    pub address_settings: AddressSettings,
8523
8524    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8525    #[cfg_attr(feature = "bon", builder(default))]
8526    pub undocumented: JsonObject,
8527}
8528
8529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8530#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8531#[cfg_attr(feature = "bon", builder(on(String, into)))]
8532pub struct UserContactRequest {
8533    #[serde(
8534        rename = "contactRequestId",
8535        deserialize_with = "deserialize_number_from_string"
8536    )]
8537    pub contact_request_id: i64,
8538
8539    #[serde(rename = "agentInvitationId")]
8540    pub agent_invitation_id: String,
8541
8542    #[serde(
8543        rename = "contactId_",
8544        skip_serializing_if = "Option::is_none",
8545        deserialize_with = "deserialize_option_number_from_string",
8546        default
8547    )]
8548    pub contact_id: Option<i64>,
8549
8550    #[serde(
8551        rename = "businessGroupId_",
8552        skip_serializing_if = "Option::is_none",
8553        deserialize_with = "deserialize_option_number_from_string",
8554        default
8555    )]
8556    pub business_group_id: Option<i64>,
8557
8558    #[serde(
8559        rename = "userContactLinkId_",
8560        skip_serializing_if = "Option::is_none",
8561        deserialize_with = "deserialize_option_number_from_string",
8562        default
8563    )]
8564    pub user_contact_link_id: Option<i64>,
8565
8566    #[serde(rename = "cReqChatVRange")]
8567    pub c_req_chat_v_range: VersionRange,
8568
8569    #[serde(rename = "localDisplayName")]
8570    pub local_display_name: String,
8571
8572    #[serde(
8573        rename = "profileId",
8574        deserialize_with = "deserialize_number_from_string"
8575    )]
8576    pub profile_id: i64,
8577
8578    #[serde(rename = "profile")]
8579    pub profile: Profile,
8580
8581    #[serde(rename = "createdAt")]
8582    pub created_at: UtcTime,
8583
8584    #[serde(rename = "updatedAt")]
8585    pub updated_at: UtcTime,
8586
8587    #[serde(rename = "xContactId", skip_serializing_if = "Option::is_none")]
8588    pub x_contact_id: Option<String>,
8589
8590    #[serde(rename = "pqSupport", default)]
8591    pub pq_support: bool,
8592
8593    #[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
8594    pub welcome_shared_msg_id: Option<String>,
8595
8596    #[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
8597    pub request_shared_msg_id: Option<String>,
8598
8599    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8600    #[cfg_attr(feature = "bon", builder(default))]
8601    pub undocumented: JsonObject,
8602}
8603
8604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8605#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8606#[cfg_attr(feature = "bon", builder(on(String, into)))]
8607pub struct UserInfo {
8608    #[serde(rename = "user")]
8609    pub user: User,
8610
8611    #[serde(
8612        rename = "unreadCount",
8613        deserialize_with = "deserialize_number_from_string"
8614    )]
8615    pub unread_count: i32,
8616
8617    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8618    #[cfg_attr(feature = "bon", builder(default))]
8619    pub undocumented: JsonObject,
8620}
8621
8622#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8623#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8624#[cfg_attr(feature = "bon", builder(on(String, into)))]
8625pub struct UserProfileUpdateSummary {
8626    #[serde(
8627        rename = "updateSuccesses",
8628        deserialize_with = "deserialize_number_from_string"
8629    )]
8630    pub update_successes: i32,
8631
8632    #[serde(
8633        rename = "updateFailures",
8634        deserialize_with = "deserialize_number_from_string"
8635    )]
8636    pub update_failures: i32,
8637
8638    #[serde(rename = "changedContacts")]
8639    pub changed_contacts: Vec<Contact>,
8640
8641    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8642    #[cfg_attr(feature = "bon", builder(default))]
8643    pub undocumented: JsonObject,
8644}
8645
8646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8647#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8648#[cfg_attr(feature = "bon", builder(on(String, into)))]
8649pub struct UserPwdHash {
8650    #[serde(rename = "hash")]
8651    pub hash: String,
8652
8653    #[serde(rename = "salt")]
8654    pub salt: String,
8655
8656    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8657    #[cfg_attr(feature = "bon", builder(default))]
8658    pub undocumented: JsonObject,
8659}
8660
8661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8662#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8663#[cfg_attr(feature = "bon", builder(on(String, into)))]
8664pub struct VersionRange {
8665    #[serde(
8666        rename = "minVersion",
8667        deserialize_with = "deserialize_number_from_string"
8668    )]
8669    pub min_version: i32,
8670
8671    #[serde(
8672        rename = "maxVersion",
8673        deserialize_with = "deserialize_number_from_string"
8674    )]
8675    pub max_version: i32,
8676
8677    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8678    #[cfg_attr(feature = "bon", builder(default))]
8679    pub undocumented: JsonObject,
8680}
8681
8682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8683#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8684#[cfg_attr(feature = "bon", builder(on(String, into)))]
8685pub struct XFTPRcvFile {
8686    #[serde(rename = "rcvFileDescription")]
8687    pub rcv_file_description: RcvFileDescr,
8688
8689    #[serde(rename = "agentRcvFileId", skip_serializing_if = "Option::is_none")]
8690    pub agent_rcv_file_id: Option<String>,
8691
8692    #[serde(rename = "agentRcvFileDeleted", default)]
8693    pub agent_rcv_file_deleted: bool,
8694
8695    #[serde(rename = "userApprovedRelays", default)]
8696    pub user_approved_relays: bool,
8697
8698    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8699    #[cfg_attr(feature = "bon", builder(default))]
8700    pub undocumented: JsonObject,
8701}
8702
8703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8704#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8705#[cfg_attr(feature = "bon", builder(on(String, into)))]
8706pub struct XFTPSndFile {
8707    #[serde(rename = "agentSndFileId")]
8708    pub agent_snd_file_id: String,
8709
8710    #[serde(
8711        rename = "privateSndFileDescr",
8712        skip_serializing_if = "Option::is_none"
8713    )]
8714    pub private_snd_file_descr: Option<String>,
8715
8716    #[serde(rename = "agentSndFileDeleted", default)]
8717    pub agent_snd_file_deleted: bool,
8718
8719    #[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
8720    pub crypto_args: Option<CryptoFileArgs>,
8721
8722    #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8723    #[cfg_attr(feature = "bon", builder(default))]
8724    pub undocumented: JsonObject,
8725}