proto-blue-api 0.3.1

AT Protocol high-level API: agent, rich text, moderation, generated types
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
// Generated by atproto-codegen. Do not edit.
//! Lexicon: tools.ozone.moderation.defs
#![allow(clippy::pedantic, clippy::nursery, clippy::all)]

use serde::{Deserialize, Serialize};

/// Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountEvent {
    pub active: bool,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    pub timestamp: proto_blue_syntax::Datetime,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountHosting {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deactivated_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deleted_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reactivated_at: Option<proto_blue_syntax::Datetime>,
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<proto_blue_syntax::Datetime>,
}

/// Statistics about a particular account subject
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountStats {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub appeal_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub escalate_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub report_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub suspend_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub takedown_count: Option<i64>,
}

/// Strike information for an account
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountStrike {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub active_strike_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub first_strike_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_strike_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub total_strike_count: Option<i64>,
}

/// Age assurance info coming directly from users. Only works on DID subjects.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AgeAssuranceEvent {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub access: Option<crate::app::bsky::ageassurance::defs::Access>,
    pub attempt_id: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub complete_ip: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub complete_ua: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub country_code: Option<String>,
    pub created_at: proto_blue_syntax::Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub init_ip: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub init_ua: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub region_code: Option<String>,
    pub status: String,
}

/// Age assurance status override by moderators. Only works on DID subjects.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AgeAssuranceOverrideEvent {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub access: Option<crate::app::bsky::ageassurance::defs::Access>,
    pub comment: String,
    pub status: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum BlobViewDetailsRefs {
    #[serde(rename = "tools.ozone.moderation.defs#imageDetails")]
    OzoneModerationDefsImageDetails(Box<ImageDetails>),
    #[serde(rename = "tools.ozone.moderation.defs#videoDetails")]
    OzoneModerationDefsVideoDetails(Box<VideoDetails>),
    #[serde(other)]
    Other,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BlobView {
    pub cid: String,
    pub created_at: proto_blue_syntax::Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub details: Option<BlobViewDetailsRefs>,
    pub mime_type: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub moderation: Option<Moderation>,
    pub size: i64,
}

/// Logs cancellation of a scheduled takedown action for an account.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CancelScheduledTakedownEvent {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
}

/// Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct IdentityEvent {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub handle: Option<proto_blue_syntax::Handle>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pds_host: Option<String>,
    pub timestamp: proto_blue_syntax::Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tombstone: Option<bool>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ImageDetails {
    pub height: i64,
    pub width: i64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventAcknowledge {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub acknowledge_account_subjects: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
}

/// Add a comment to a subject. An empty comment will clear any previously set sticky comment.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventComment {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sticky: Option<bool>,
}

/// Divert a record's blobs to a 3rd party service for further scanning/tagging
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventDivert {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
}

/// Keep a log of outgoing email to a user
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventEmail {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub content: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub is_delivered: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub policies: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub severity_level: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_expires_at: Option<proto_blue_syntax::Datetime>,
    pub subject_line: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventEscalate {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
}

/// Apply/Negate labels on a subject
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventLabel {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    pub create_label_vals: Vec<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration_in_hours: Option<i64>,
    pub negate_label_vals: Vec<String>,
}

/// Mute incoming reports on a subject
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventMute {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    pub duration_in_hours: i64,
}

/// Mute incoming reports from an account
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventMuteReporter {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration_in_hours: Option<i64>,
}

/// Set priority score of the subject. Higher score means higher priority.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventPriorityScore {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    pub score: i64,
}

/// Report a subject
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventReport {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub is_reporter_muted: Option<bool>,
    pub report_type: crate::com::atproto::moderation::defs::ReasonType,
}

/// Resolve appeal on a subject
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventResolveAppeal {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
}

/// Revert take down action on a subject
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventReverseTakedown {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub policies: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub severity_level: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_count: Option<i64>,
}

/// Add/Remove a tag on a subject
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventTag {
    pub add: Vec<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    pub remove: Vec<String>,
}

/// Take down a subject permanently or temporarily
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventTakedown {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub acknowledge_account_subjects: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration_in_hours: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub policies: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub severity_level: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub strike_expires_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub target_services: Option<Vec<String>>,
}

/// Unmute action on a subject
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventUnmute {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
}

/// Unmute incoming reports from an account
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventUnmuteReporter {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum ModEventViewEventRefs {
    #[serde(rename = "tools.ozone.moderation.defs#modEventTakedown")]
    OzoneModerationDefsModEventTakedown(Box<ModEventTakedown>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReverseTakedown")]
    OzoneModerationDefsModEventReverseTakedown(Box<ModEventReverseTakedown>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventComment")]
    OzoneModerationDefsModEventComment(Box<ModEventComment>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReport")]
    OzoneModerationDefsModEventReport(Box<ModEventReport>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventLabel")]
    OzoneModerationDefsModEventLabel(Box<ModEventLabel>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventAcknowledge")]
    OzoneModerationDefsModEventAcknowledge(Box<ModEventAcknowledge>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEscalate")]
    OzoneModerationDefsModEventEscalate(Box<ModEventEscalate>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMute")]
    OzoneModerationDefsModEventMute(Box<ModEventMute>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmute")]
    OzoneModerationDefsModEventUnmute(Box<ModEventUnmute>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMuteReporter")]
    OzoneModerationDefsModEventMuteReporter(Box<ModEventMuteReporter>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmuteReporter")]
    OzoneModerationDefsModEventUnmuteReporter(Box<ModEventUnmuteReporter>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEmail")]
    OzoneModerationDefsModEventEmail(Box<ModEventEmail>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventResolveAppeal")]
    OzoneModerationDefsModEventResolveAppeal(Box<ModEventResolveAppeal>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventDivert")]
    OzoneModerationDefsModEventDivert(Box<ModEventDivert>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventTag")]
    OzoneModerationDefsModEventTag(Box<ModEventTag>),
    #[serde(rename = "tools.ozone.moderation.defs#accountEvent")]
    OzoneModerationDefsAccountEvent(Box<AccountEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#identityEvent")]
    OzoneModerationDefsIdentityEvent(Box<IdentityEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#recordEvent")]
    OzoneModerationDefsRecordEvent(Box<RecordEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventPriorityScore")]
    OzoneModerationDefsModEventPriorityScore(Box<ModEventPriorityScore>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceEvent")]
    OzoneModerationDefsAgeAssuranceEvent(Box<AgeAssuranceEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceOverrideEvent")]
    OzoneModerationDefsAgeAssuranceOverrideEvent(Box<AgeAssuranceOverrideEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#revokeAccountCredentialsEvent")]
    OzoneModerationDefsRevokeAccountCredentialsEvent(Box<RevokeAccountCredentialsEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#scheduleTakedownEvent")]
    OzoneModerationDefsScheduleTakedownEvent(Box<ScheduleTakedownEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#cancelScheduledTakedownEvent")]
    OzoneModerationDefsCancelScheduledTakedownEvent(Box<CancelScheduledTakedownEvent>),
    #[serde(other)]
    Other,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum ModEventViewSubjectRefs {
    #[serde(rename = "com.atproto.admin.defs#repoRef")]
    AtprotoAdminDefsRepoRef(Box<crate::com::atproto::admin::defs::RepoRef>),
    #[serde(rename = "com.atproto.repo.strongRef")]
    AtprotoRepoStrongRef(Box<crate::com::atproto::repo::strong_ref::Main>),
    #[serde(rename = "chat.bsky.convo.defs#messageRef")]
    BskyConvoDefsMessageRef(Box<crate::chat::bsky::convo::defs::MessageRef>),
    #[serde(other)]
    Other,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventView {
    pub created_at: proto_blue_syntax::Datetime,
    pub created_by: proto_blue_syntax::Did,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub creator_handle: Option<String>,
    pub event: ModEventViewEventRefs,
    pub id: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mod_tool: Option<ModTool>,
    pub subject: ModEventViewSubjectRefs,
    pub subject_blob_cids: Vec<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_handle: Option<String>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum ModEventViewDetailEventRefs {
    #[serde(rename = "tools.ozone.moderation.defs#modEventTakedown")]
    OzoneModerationDefsModEventTakedown(Box<ModEventTakedown>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReverseTakedown")]
    OzoneModerationDefsModEventReverseTakedown(Box<ModEventReverseTakedown>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventComment")]
    OzoneModerationDefsModEventComment(Box<ModEventComment>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventReport")]
    OzoneModerationDefsModEventReport(Box<ModEventReport>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventLabel")]
    OzoneModerationDefsModEventLabel(Box<ModEventLabel>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventAcknowledge")]
    OzoneModerationDefsModEventAcknowledge(Box<ModEventAcknowledge>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEscalate")]
    OzoneModerationDefsModEventEscalate(Box<ModEventEscalate>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMute")]
    OzoneModerationDefsModEventMute(Box<ModEventMute>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmute")]
    OzoneModerationDefsModEventUnmute(Box<ModEventUnmute>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventMuteReporter")]
    OzoneModerationDefsModEventMuteReporter(Box<ModEventMuteReporter>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventUnmuteReporter")]
    OzoneModerationDefsModEventUnmuteReporter(Box<ModEventUnmuteReporter>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventEmail")]
    OzoneModerationDefsModEventEmail(Box<ModEventEmail>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventResolveAppeal")]
    OzoneModerationDefsModEventResolveAppeal(Box<ModEventResolveAppeal>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventDivert")]
    OzoneModerationDefsModEventDivert(Box<ModEventDivert>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventTag")]
    OzoneModerationDefsModEventTag(Box<ModEventTag>),
    #[serde(rename = "tools.ozone.moderation.defs#accountEvent")]
    OzoneModerationDefsAccountEvent(Box<AccountEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#identityEvent")]
    OzoneModerationDefsIdentityEvent(Box<IdentityEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#recordEvent")]
    OzoneModerationDefsRecordEvent(Box<RecordEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#modEventPriorityScore")]
    OzoneModerationDefsModEventPriorityScore(Box<ModEventPriorityScore>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceEvent")]
    OzoneModerationDefsAgeAssuranceEvent(Box<AgeAssuranceEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#ageAssuranceOverrideEvent")]
    OzoneModerationDefsAgeAssuranceOverrideEvent(Box<AgeAssuranceOverrideEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#revokeAccountCredentialsEvent")]
    OzoneModerationDefsRevokeAccountCredentialsEvent(Box<RevokeAccountCredentialsEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#scheduleTakedownEvent")]
    OzoneModerationDefsScheduleTakedownEvent(Box<ScheduleTakedownEvent>),
    #[serde(rename = "tools.ozone.moderation.defs#cancelScheduledTakedownEvent")]
    OzoneModerationDefsCancelScheduledTakedownEvent(Box<CancelScheduledTakedownEvent>),
    #[serde(other)]
    Other,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum ModEventViewDetailSubjectRefs {
    #[serde(rename = "tools.ozone.moderation.defs#repoView")]
    OzoneModerationDefsRepoView(Box<RepoView>),
    #[serde(rename = "tools.ozone.moderation.defs#repoViewNotFound")]
    OzoneModerationDefsRepoViewNotFound(Box<RepoViewNotFound>),
    #[serde(rename = "tools.ozone.moderation.defs#recordView")]
    OzoneModerationDefsRecordView(Box<RecordView>),
    #[serde(rename = "tools.ozone.moderation.defs#recordViewNotFound")]
    OzoneModerationDefsRecordViewNotFound(Box<RecordViewNotFound>),
    #[serde(other)]
    Other,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModEventViewDetail {
    pub created_at: proto_blue_syntax::Datetime,
    pub created_by: proto_blue_syntax::Did,
    pub event: ModEventViewDetailEventRefs,
    pub id: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mod_tool: Option<ModTool>,
    pub subject: ModEventViewDetailSubjectRefs,
    pub subject_blobs: Vec<BlobView>,
}

/// Moderation tool information for tracing the source of the action
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModTool {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub meta: Option<serde_json::Value>,
    pub name: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Moderation {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_status: Option<SubjectStatusView>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ModerationDetail {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_status: Option<SubjectStatusView>,
}

/// Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RecordEvent {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    pub op: String,
    pub timestamp: proto_blue_syntax::Datetime,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RecordHosting {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub created_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deleted_at: Option<proto_blue_syntax::Datetime>,
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<proto_blue_syntax::Datetime>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RecordView {
    pub blob_cids: Vec<String>,
    pub cid: String,
    pub indexed_at: proto_blue_syntax::Datetime,
    pub moderation: Moderation,
    pub repo: RepoView,
    pub uri: proto_blue_syntax::AtUri,
    pub value: serde_json::Value,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RecordViewDetail {
    pub blobs: Vec<BlobView>,
    pub cid: String,
    pub indexed_at: proto_blue_syntax::Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<crate::com::atproto::label::defs::Label>>,
    pub moderation: ModerationDetail,
    pub repo: RepoView,
    pub uri: proto_blue_syntax::AtUri,
    pub value: serde_json::Value,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RecordViewNotFound {
    pub uri: proto_blue_syntax::AtUri,
}

/// Statistics about a set of record subject items
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RecordsStats {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub appealed_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub escalated_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub pending_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub processed_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reported_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub takendown_count: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub total_reports: Option<i64>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RepoView {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deactivated_at: Option<proto_blue_syntax::Datetime>,
    pub did: proto_blue_syntax::Did,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email: Option<String>,
    pub handle: proto_blue_syntax::Handle,
    pub indexed_at: proto_blue_syntax::Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invite_note: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invited_by: Option<crate::com::atproto::server::defs::InviteCode>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invites_disabled: Option<bool>,
    pub moderation: Moderation,
    pub related_records: Vec<serde_json::Value>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub threat_signatures: Option<Vec<crate::com::atproto::admin::defs::ThreatSignature>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RepoViewDetail {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub deactivated_at: Option<proto_blue_syntax::Datetime>,
    pub did: proto_blue_syntax::Did,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email_confirmed_at: Option<proto_blue_syntax::Datetime>,
    pub handle: proto_blue_syntax::Handle,
    pub indexed_at: proto_blue_syntax::Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invite_note: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invited_by: Option<crate::com::atproto::server::defs::InviteCode>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invites: Option<Vec<crate::com::atproto::server::defs::InviteCode>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub invites_disabled: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub labels: Option<Vec<crate::com::atproto::label::defs::Label>>,
    pub moderation: ModerationDetail,
    pub related_records: Vec<serde_json::Value>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub threat_signatures: Option<Vec<crate::com::atproto::admin::defs::ThreatSignature>>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RepoViewNotFound {
    pub did: proto_blue_syntax::Did,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReporterStats {
    pub account_report_count: i64,
    pub did: proto_blue_syntax::Did,
    pub labeled_account_count: i64,
    pub labeled_record_count: i64,
    pub record_report_count: i64,
    pub reported_account_count: i64,
    pub reported_record_count: i64,
    pub takendown_account_count: i64,
    pub takendown_record_count: i64,
}

/// Moderator review status of a subject: Closed. Indicates that the subject was already reviewed and resolved by a moderator
pub const REVIEW_CLOSED: &str = "tools.ozone.moderation.defs#reviewClosed";

/// Moderator review status of a subject: Escalated. Indicates that the subject was escalated for review by a moderator
pub const REVIEW_ESCALATED: &str = "tools.ozone.moderation.defs#reviewEscalated";

/// Moderator review status of a subject: Unnecessary. Indicates that the subject does not need a review at the moment but there is probably some moderation related metadata available for it
pub const REVIEW_NONE: &str = "tools.ozone.moderation.defs#reviewNone";

/// Moderator review status of a subject: Open. Indicates that the subject needs to be reviewed by a moderator
pub const REVIEW_OPEN: &str = "tools.ozone.moderation.defs#reviewOpen";

/// Account credentials revocation by moderators. Only works on DID subjects.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RevokeAccountCredentialsEvent {
    pub comment: String,
}

/// Logs a scheduled takedown action for an account.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ScheduleTakedownEvent {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execute_after: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execute_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execute_until: Option<proto_blue_syntax::Datetime>,
}

/// View of a scheduled moderation action
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ScheduledActionView {
    pub action: String,
    pub created_at: proto_blue_syntax::Datetime,
    pub created_by: proto_blue_syntax::Did,
    pub did: proto_blue_syntax::Did,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub event_data: Option<serde_json::Value>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execute_after: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execute_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execute_until: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub execution_event_id: Option<i64>,
    pub id: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_executed_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_failure_reason: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub randomize_execution: Option<bool>,
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<proto_blue_syntax::Datetime>,
}

pub type SubjectReviewState = String;
pub const SUBJECT_REVIEW_STATE_REVIEW_OPEN: &str = "tools.ozone.moderation.defs#reviewOpen";
pub const SUBJECT_REVIEW_STATE_REVIEW_ESCALATED: &str =
    "tools.ozone.moderation.defs#reviewEscalated";
pub const SUBJECT_REVIEW_STATE_REVIEW_CLOSED: &str = "tools.ozone.moderation.defs#reviewClosed";
pub const SUBJECT_REVIEW_STATE_REVIEW_NONE: &str = "tools.ozone.moderation.defs#reviewNone";

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum SubjectStatusViewHostingRefs {
    #[serde(rename = "tools.ozone.moderation.defs#accountHosting")]
    OzoneModerationDefsAccountHosting(Box<AccountHosting>),
    #[serde(rename = "tools.ozone.moderation.defs#recordHosting")]
    OzoneModerationDefsRecordHosting(Box<RecordHosting>),
    #[serde(other)]
    Other,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum SubjectStatusViewSubjectRefs {
    #[serde(rename = "com.atproto.admin.defs#repoRef")]
    AtprotoAdminDefsRepoRef(Box<crate::com::atproto::admin::defs::RepoRef>),
    #[serde(rename = "com.atproto.repo.strongRef")]
    AtprotoRepoStrongRef(Box<crate::com::atproto::repo::strong_ref::Main>),
    #[serde(rename = "chat.bsky.convo.defs#messageRef")]
    BskyConvoDefsMessageRef(Box<crate::chat::bsky::convo::defs::MessageRef>),
    #[serde(other)]
    Other,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SubjectStatusView {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub account_stats: Option<AccountStats>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub account_strike: Option<AccountStrike>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub age_assurance_state: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub age_assurance_updated_by: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub appealed: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub comment: Option<String>,
    pub created_at: proto_blue_syntax::Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub hosting: Option<SubjectStatusViewHostingRefs>,
    pub id: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_appealed_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_reported_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_reviewed_at: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub last_reviewed_by: Option<proto_blue_syntax::Did>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mute_reporting_until: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub mute_until: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priority_score: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub records_stats: Option<RecordsStats>,
    pub review_state: SubjectReviewState,
    pub subject: SubjectStatusViewSubjectRefs,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_blob_cids: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub subject_repo_handle: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub suspend_until: Option<proto_blue_syntax::Datetime>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub takendown: Option<bool>,
    pub updated_at: proto_blue_syntax::Datetime,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "$type")]
pub enum SubjectViewProfileRefs {
    #[serde(other)]
    Other,
}

/// Detailed view of a subject. For record subjects, the author's repo and profile will be returned.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SubjectView {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub profile: Option<SubjectViewProfileRefs>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub record: Option<RecordViewDetail>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub repo: Option<RepoViewDetail>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<SubjectStatusView>,
    pub subject: String,
    #[serde(rename = "type")]
    pub r#type: crate::com::atproto::moderation::defs::SubjectType,
}

/// Moderation event timeline event for a PLC create operation
pub const TIMELINE_EVENT_PLC_CREATE: &str = "tools.ozone.moderation.defs#timelineEventPlcCreate";

/// Moderation event timeline event for generic PLC operation
pub const TIMELINE_EVENT_PLC_OPERATION: &str =
    "tools.ozone.moderation.defs#timelineEventPlcOperation";

/// Moderation event timeline event for a PLC tombstone operation
pub const TIMELINE_EVENT_PLC_TOMBSTONE: &str =
    "tools.ozone.moderation.defs#timelineEventPlcTombstone";

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VideoDetails {
    pub height: i64,
    pub length: i64,
    pub width: i64,
}