ydp 0.1.0-alpha.2

A strongly typed, async-only Chrome DevTools Protocol client for Rust
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
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
///开放字符串枚举;已知值不分配 String,未知值拥有原始文本。协议来源:Security.type.CertificateErrorAction。
///
///协议原文:
///
///<pre>The action to take when a certificate error occurs. continue will continue processing the
///request and cancel will cancel the request.</pre>
///
///
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum CertificateErrorAction {
    ///协议值 "continue"。
    Continue,
    ///协议值 "cancel"。
    Cancel,
    ///未知协议文本;Clone 复制字符串,编码保持原值。
    Unknown(String),
}
impl CertificateErrorAction {
    ///借用原始协议字符串,生命周期绑定自身。
    ///
    ///```
    ///let value = ydp::security::types::CertificateErrorAction::from(String::from("future-value"));
    ///assert_eq!(value.as_str(), "future-value");
    ///```
    pub fn as_str(&self) -> &str {
        match self {
            Self::Continue => "continue",
            Self::Cancel => "cancel",
            Self::Unknown(value) => value,
        }
    }
}
impl AsRef<str> for CertificateErrorAction {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}
impl From<String> for CertificateErrorAction {
    fn from(value: String) -> Self {
        match value.as_str() {
            "continue" => CertificateErrorAction::Continue,
            "cancel" => CertificateErrorAction::Cancel,
            _ => Self::Unknown(value),
        }
    }
}
impl serde::Serialize for CertificateErrorAction {
    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_str(self.as_str())
    }
}
impl<'de> serde::Deserialize<'de> for CertificateErrorAction {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct Visitor;
        impl<'de> serde::de::Visitor<'de> for Visitor {
            type Value = CertificateErrorAction;
            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.write_str("协议字符串枚举")
            }
            fn visit_str<E: serde::de::Error>(self, v: &str) -> Result<Self::Value, E> {
                Ok(match v {
                    "continue" => CertificateErrorAction::Continue,
                    "cancel" => CertificateErrorAction::Cancel,
                    _ => CertificateErrorAction::Unknown(v.to_owned()),
                })
            }
            fn visit_string<E: serde::de::Error>(self, v: String) -> Result<Self::Value, E> {
                Ok(CertificateErrorAction::from(v))
            }
        }
        d.deserialize_str(Visitor)
    }
}
///命名协议值;保持独立 Rust 类型身份,Clone 按底层值复制。协议来源:Security.type.CertificateId。
///
///协议原文:
///
///<pre>An internal certificate ID value.</pre>
///
///
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(transparent)]
pub struct CertificateId(i64);
impl CertificateId {
    ///消耗底层值构造命名包装,不新增验证或额外分配。
    ///
    ///```
    ///let value: ydp::security::types::CertificateId = serde_json::from_str("0").unwrap();
    ///let inner = value.into_inner();
    ///let restored = ydp::security::types::CertificateId::new(inner);
    ///assert_eq!(serde_json::to_value(restored).unwrap(), serde_json::from_str::<serde_json::Value>("0").unwrap());
    ///```
    pub fn new(value: i64) -> Self {
        Self(value)
    }
    ///消耗包装并移出底层拥有型值,不复制数据。
    ///
    ///```
    ///let value: ydp::security::types::CertificateId = serde_json::from_str("0").unwrap();
    ///let inner = value.into_inner();
    ///let restored = ydp::security::types::CertificateId::new(inner);
    ///assert_eq!(serde_json::to_value(restored).unwrap(), serde_json::from_str::<serde_json::Value>("0").unwrap());
    ///```
    pub fn into_inner(self) -> i64 {
        self.0
    }
}
///拥有型协议数据;Clone 复制字段,未知 object 字段容忍但不保留。协议来源:Security.type.CertificateSecurityState。
///
///协议原文:
///
///<pre>Details about the security state of the page certificate.</pre>
///
///此项为 experimental,端点可能不支持。
#[derive(Debug, Clone, serde::Serialize)]
pub struct CertificateSecurityState {
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/protocol。
    ///
    ///协议原文:
    ///
    ///<pre>Protocol name (e.g. "TLS 1.2" or "QUIC").</pre>
    ///
    ///
    #[serde(rename = "protocol")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub protocol: String,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/keyExchange。
    ///
    ///协议原文:
    ///
    ///<pre>Key Exchange used by the connection, or the empty string if not applicable.</pre>
    ///
    ///
    #[serde(rename = "keyExchange")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub key_exchange: String,
    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.CertificateSecurityState/properties/keyExchangeGroup。
    ///
    ///协议原文:
    ///
    ///<pre>(EC)DH group used by the connection, if applicable.</pre>
    ///
    ///
    #[serde(rename = "keyExchangeGroup")]
    #[serde(
        default,
        deserialize_with = "ydp_core::binding_support::presence",
        skip_serializing_if = "Option::is_none"
    )]
    pub key_exchange_group: Option<String>,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/cipher。
    ///
    ///协议原文:
    ///
    ///<pre>Cipher name.</pre>
    ///
    ///
    #[serde(rename = "cipher")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub cipher: String,
    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.CertificateSecurityState/properties/mac。
    ///
    ///协议原文:
    ///
    ///<pre>TLS MAC. Note that AEAD ciphers do not have separate MACs.</pre>
    ///
    ///
    #[serde(rename = "mac")]
    #[serde(
        default,
        deserialize_with = "ydp_core::binding_support::presence",
        skip_serializing_if = "Option::is_none"
    )]
    pub mac: Option<String>,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/certificate。
    ///
    ///协议原文:
    ///
    ///<pre>Page certificate.</pre>
    ///
    ///
    #[serde(rename = "certificate")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub certificate: Vec<String>,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/subjectName。
    ///
    ///协议原文:
    ///
    ///<pre>Certificate subject name.</pre>
    ///
    ///
    #[serde(rename = "subjectName")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub subject_name: String,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/issuer。
    ///
    ///协议原文:
    ///
    ///<pre>Name of the issuing CA.</pre>
    ///
    ///
    #[serde(rename = "issuer")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub issuer: String,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/validFrom。
    ///
    ///协议原文:
    ///
    ///<pre>Certificate valid from date.</pre>
    ///
    ///
    #[serde(rename = "validFrom")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub valid_from: crate::network::types::TimeSinceEpoch,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/validTo。
    ///
    ///协议原文:
    ///
    ///<pre>Certificate valid to (expiration) date</pre>
    ///
    ///
    #[serde(rename = "validTo")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub valid_to: crate::network::types::TimeSinceEpoch,
    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.CertificateSecurityState/properties/certificateNetworkError。
    ///
    ///协议原文:
    ///
    ///<pre>The highest priority network error code, if the certificate has an error.</pre>
    ///
    ///
    #[serde(rename = "certificateNetworkError")]
    #[serde(
        default,
        deserialize_with = "ydp_core::binding_support::presence",
        skip_serializing_if = "Option::is_none"
    )]
    pub certificate_network_error: Option<String>,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/certificateHasWeakSignature。
    ///
    ///协议原文:
    ///
    ///<pre>True if the certificate uses a weak signature algorithm.</pre>
    ///
    ///
    #[serde(rename = "certificateHasWeakSignature")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub certificate_has_weak_signature: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/certificateHasSha1Signature。
    ///
    ///协议原文:
    ///
    ///<pre>True if the certificate has a SHA1 signature in the chain.</pre>
    ///
    ///
    #[serde(rename = "certificateHasSha1Signature")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub certificate_has_sha1_signature: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/modernSSL。
    ///
    ///协议原文:
    ///
    ///<pre>True if modern SSL</pre>
    ///
    ///
    #[serde(rename = "modernSSL")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub modern_ssl: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/obsoleteSslProtocol。
    ///
    ///协议原文:
    ///
    ///<pre>True if the connection is using an obsolete SSL protocol.</pre>
    ///
    ///
    #[serde(rename = "obsoleteSslProtocol")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub obsolete_ssl_protocol: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/obsoleteSslKeyExchange。
    ///
    ///协议原文:
    ///
    ///<pre>True if the connection is using an obsolete SSL key exchange.</pre>
    ///
    ///
    #[serde(rename = "obsoleteSslKeyExchange")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub obsolete_ssl_key_exchange: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/obsoleteSslCipher。
    ///
    ///协议原文:
    ///
    ///<pre>True if the connection is using an obsolete SSL cipher.</pre>
    ///
    ///
    #[serde(rename = "obsoleteSslCipher")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub obsolete_ssl_cipher: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/obsoleteSslSignature。
    ///
    ///协议原文:
    ///
    ///<pre>True if the connection is using an obsolete SSL signature.</pre>
    ///
    ///
    #[serde(rename = "obsoleteSslSignature")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub obsolete_ssl_signature: bool,
}
impl<'de> serde::Deserialize<'de> for CertificateSecurityState {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct Visitor;
        impl<'de> serde::de::Visitor<'de> for Visitor {
            type Value = CertificateSecurityState;
            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.write_str("协议 object")
            }
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                a: A,
            ) -> Result<Self::Value, A::Error> {
                #[derive(serde::Deserialize)]
                struct Fields {
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/protocol。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Protocol name (e.g. "TLS 1.2" or "QUIC").</pre>
                    ///
                    ///
                    #[serde(rename = "protocol")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub protocol: String,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/keyExchange。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Key Exchange used by the connection, or the empty string if not applicable.</pre>
                    ///
                    ///
                    #[serde(rename = "keyExchange")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub key_exchange: String,
                    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.CertificateSecurityState/properties/keyExchangeGroup。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>(EC)DH group used by the connection, if applicable.</pre>
                    ///
                    ///
                    #[serde(rename = "keyExchangeGroup")]
                    #[serde(
                        default,
                        deserialize_with = "ydp_core::binding_support::presence",
                        skip_serializing_if = "Option::is_none"
                    )]
                    pub key_exchange_group: Option<String>,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/cipher。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Cipher name.</pre>
                    ///
                    ///
                    #[serde(rename = "cipher")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub cipher: String,
                    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.CertificateSecurityState/properties/mac。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>TLS MAC. Note that AEAD ciphers do not have separate MACs.</pre>
                    ///
                    ///
                    #[serde(rename = "mac")]
                    #[serde(
                        default,
                        deserialize_with = "ydp_core::binding_support::presence",
                        skip_serializing_if = "Option::is_none"
                    )]
                    pub mac: Option<String>,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/certificate。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Page certificate.</pre>
                    ///
                    ///
                    #[serde(rename = "certificate")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub certificate: Vec<String>,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/subjectName。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Certificate subject name.</pre>
                    ///
                    ///
                    #[serde(rename = "subjectName")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub subject_name: String,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/issuer。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Name of the issuing CA.</pre>
                    ///
                    ///
                    #[serde(rename = "issuer")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub issuer: String,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/validFrom。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Certificate valid from date.</pre>
                    ///
                    ///
                    #[serde(rename = "validFrom")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub valid_from: crate::network::types::TimeSinceEpoch,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/validTo。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Certificate valid to (expiration) date</pre>
                    ///
                    ///
                    #[serde(rename = "validTo")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub valid_to: crate::network::types::TimeSinceEpoch,
                    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.CertificateSecurityState/properties/certificateNetworkError。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>The highest priority network error code, if the certificate has an error.</pre>
                    ///
                    ///
                    #[serde(rename = "certificateNetworkError")]
                    #[serde(
                        default,
                        deserialize_with = "ydp_core::binding_support::presence",
                        skip_serializing_if = "Option::is_none"
                    )]
                    pub certificate_network_error: Option<String>,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/certificateHasWeakSignature。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>True if the certificate uses a weak signature algorithm.</pre>
                    ///
                    ///
                    #[serde(rename = "certificateHasWeakSignature")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub certificate_has_weak_signature: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/certificateHasSha1Signature。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>True if the certificate has a SHA1 signature in the chain.</pre>
                    ///
                    ///
                    #[serde(rename = "certificateHasSha1Signature")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub certificate_has_sha1_signature: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/modernSSL。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>True if modern SSL</pre>
                    ///
                    ///
                    #[serde(rename = "modernSSL")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub modern_ssl: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/obsoleteSslProtocol。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>True if the connection is using an obsolete SSL protocol.</pre>
                    ///
                    ///
                    #[serde(rename = "obsoleteSslProtocol")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub obsolete_ssl_protocol: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/obsoleteSslKeyExchange。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>True if the connection is using an obsolete SSL key exchange.</pre>
                    ///
                    ///
                    #[serde(rename = "obsoleteSslKeyExchange")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub obsolete_ssl_key_exchange: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/obsoleteSslCipher。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>True if the connection is using an obsolete SSL cipher.</pre>
                    ///
                    ///
                    #[serde(rename = "obsoleteSslCipher")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub obsolete_ssl_cipher: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.CertificateSecurityState/properties/obsoleteSslSignature。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>True if the connection is using an obsolete SSL signature.</pre>
                    ///
                    ///
                    #[serde(rename = "obsoleteSslSignature")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub obsolete_ssl_signature: bool,
                }
                let fields = <Fields as serde::Deserialize>::deserialize(
                    serde::de::value::MapAccessDeserializer::new(a),
                )?;
                Ok(CertificateSecurityState {
                    protocol: fields.protocol,
                    key_exchange: fields.key_exchange,
                    key_exchange_group: fields.key_exchange_group,
                    cipher: fields.cipher,
                    mac: fields.mac,
                    certificate: fields.certificate,
                    subject_name: fields.subject_name,
                    issuer: fields.issuer,
                    valid_from: fields.valid_from,
                    valid_to: fields.valid_to,
                    certificate_network_error: fields.certificate_network_error,
                    certificate_has_weak_signature: fields.certificate_has_weak_signature,
                    certificate_has_sha1_signature: fields.certificate_has_sha1_signature,
                    modern_ssl: fields.modern_ssl,
                    obsolete_ssl_protocol: fields.obsolete_ssl_protocol,
                    obsolete_ssl_key_exchange: fields.obsolete_ssl_key_exchange,
                    obsolete_ssl_cipher: fields.obsolete_ssl_cipher,
                    obsolete_ssl_signature: fields.obsolete_ssl_signature,
                })
            }
        }
        d.deserialize_map(Visitor)
    }
}
///拥有型协议数据;Clone 复制字段,未知 object 字段容忍但不保留。协议来源:Security.type.InsecureContentStatus。
///
///协议原文:
///
///<pre>Information about insecure content on the page.</pre>
///
///此项已 deprecated,保留用于旧端点兼容。
#[derive(Debug, Clone, serde::Serialize)]
pub struct InsecureContentStatus {
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/ranMixedContent。
    ///
    ///协议原文:
    ///
    ///<pre>Always false.</pre>
    ///
    ///
    #[serde(rename = "ranMixedContent")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub ran_mixed_content: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/displayedMixedContent。
    ///
    ///协议原文:
    ///
    ///<pre>Always false.</pre>
    ///
    ///
    #[serde(rename = "displayedMixedContent")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub displayed_mixed_content: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/containedMixedForm。
    ///
    ///协议原文:
    ///
    ///<pre>Always false.</pre>
    ///
    ///
    #[serde(rename = "containedMixedForm")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub contained_mixed_form: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/ranContentWithCertErrors。
    ///
    ///协议原文:
    ///
    ///<pre>Always false.</pre>
    ///
    ///
    #[serde(rename = "ranContentWithCertErrors")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub ran_content_with_cert_errors: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/displayedContentWithCertErrors。
    ///
    ///协议原文:
    ///
    ///<pre>Always false.</pre>
    ///
    ///
    #[serde(rename = "displayedContentWithCertErrors")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub displayed_content_with_cert_errors: bool,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/ranInsecureContentStyle。
    ///
    ///协议原文:
    ///
    ///<pre>Always set to unknown.</pre>
    ///
    ///
    #[serde(rename = "ranInsecureContentStyle")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub ran_insecure_content_style: crate::security::types::SecurityState,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/displayedInsecureContentStyle。
    ///
    ///协议原文:
    ///
    ///<pre>Always set to unknown.</pre>
    ///
    ///
    #[serde(rename = "displayedInsecureContentStyle")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub displayed_insecure_content_style: crate::security::types::SecurityState,
}
impl<'de> serde::Deserialize<'de> for InsecureContentStatus {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct Visitor;
        impl<'de> serde::de::Visitor<'de> for Visitor {
            type Value = InsecureContentStatus;
            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.write_str("协议 object")
            }
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                a: A,
            ) -> Result<Self::Value, A::Error> {
                #[derive(serde::Deserialize)]
                struct Fields {
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/ranMixedContent。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Always false.</pre>
                    ///
                    ///
                    #[serde(rename = "ranMixedContent")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub ran_mixed_content: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/displayedMixedContent。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Always false.</pre>
                    ///
                    ///
                    #[serde(rename = "displayedMixedContent")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub displayed_mixed_content: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/containedMixedForm。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Always false.</pre>
                    ///
                    ///
                    #[serde(rename = "containedMixedForm")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub contained_mixed_form: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/ranContentWithCertErrors。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Always false.</pre>
                    ///
                    ///
                    #[serde(rename = "ranContentWithCertErrors")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub ran_content_with_cert_errors: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/displayedContentWithCertErrors。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Always false.</pre>
                    ///
                    ///
                    #[serde(rename = "displayedContentWithCertErrors")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub displayed_content_with_cert_errors: bool,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/ranInsecureContentStyle。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Always set to unknown.</pre>
                    ///
                    ///
                    #[serde(rename = "ranInsecureContentStyle")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub ran_insecure_content_style: crate::security::types::SecurityState,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.InsecureContentStatus/properties/displayedInsecureContentStyle。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Always set to unknown.</pre>
                    ///
                    ///
                    #[serde(rename = "displayedInsecureContentStyle")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub displayed_insecure_content_style: crate::security::types::SecurityState,
                }
                let fields = <Fields as serde::Deserialize>::deserialize(
                    serde::de::value::MapAccessDeserializer::new(a),
                )?;
                Ok(InsecureContentStatus {
                    ran_mixed_content: fields.ran_mixed_content,
                    displayed_mixed_content: fields.displayed_mixed_content,
                    contained_mixed_form: fields.contained_mixed_form,
                    ran_content_with_cert_errors: fields.ran_content_with_cert_errors,
                    displayed_content_with_cert_errors: fields.displayed_content_with_cert_errors,
                    ran_insecure_content_style: fields.ran_insecure_content_style,
                    displayed_insecure_content_style: fields.displayed_insecure_content_style,
                })
            }
        }
        d.deserialize_map(Visitor)
    }
}
///开放字符串枚举;已知值不分配 String,未知值拥有原始文本。协议来源:Security.type.MixedContentType。
///
///协议原文:
///
///<pre>A description of mixed content (HTTP resources on HTTPS pages), as defined by
///https://www.w3.org/TR/mixed-content/#categories</pre>
///
///
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum MixedContentType {
    ///协议值 "blockable"。
    Blockable,
    ///协议值 "optionally-blockable"。
    OptionallyBlockable,
    ///协议值 "none"。
    None,
    ///未知协议文本;Clone 复制字符串,编码保持原值。
    Unknown(String),
}
impl MixedContentType {
    ///借用原始协议字符串,生命周期绑定自身。
    ///
    ///```
    ///let value = ydp::security::types::MixedContentType::from(String::from("future-value"));
    ///assert_eq!(value.as_str(), "future-value");
    ///```
    pub fn as_str(&self) -> &str {
        match self {
            Self::Blockable => "blockable",
            Self::OptionallyBlockable => "optionally-blockable",
            Self::None => "none",
            Self::Unknown(value) => value,
        }
    }
}
impl AsRef<str> for MixedContentType {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}
impl From<String> for MixedContentType {
    fn from(value: String) -> Self {
        match value.as_str() {
            "blockable" => MixedContentType::Blockable,
            "optionally-blockable" => MixedContentType::OptionallyBlockable,
            "none" => MixedContentType::None,
            _ => Self::Unknown(value),
        }
    }
}
impl serde::Serialize for MixedContentType {
    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_str(self.as_str())
    }
}
impl<'de> serde::Deserialize<'de> for MixedContentType {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct Visitor;
        impl<'de> serde::de::Visitor<'de> for Visitor {
            type Value = MixedContentType;
            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.write_str("协议字符串枚举")
            }
            fn visit_str<E: serde::de::Error>(self, v: &str) -> Result<Self::Value, E> {
                Ok(match v {
                    "blockable" => MixedContentType::Blockable,
                    "optionally-blockable" => MixedContentType::OptionallyBlockable,
                    "none" => MixedContentType::None,
                    _ => MixedContentType::Unknown(v.to_owned()),
                })
            }
            fn visit_string<E: serde::de::Error>(self, v: String) -> Result<Self::Value, E> {
                Ok(MixedContentType::from(v))
            }
        }
        d.deserialize_str(Visitor)
    }
}
///拥有型协议数据;Clone 复制字段,未知 object 字段容忍但不保留。协议来源:Security.type.SafetyTipInfo。此项为 experimental,端点可能不支持。
#[derive(Debug, Clone, serde::Serialize)]
pub struct SafetyTipInfo {
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SafetyTipInfo/properties/safetyTipStatus。
    ///
    ///协议原文:
    ///
    ///<pre>Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.</pre>
    ///
    ///
    #[serde(rename = "safetyTipStatus")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub safety_tip_status: crate::security::types::SafetyTipStatus,
    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.SafetyTipInfo/properties/safeUrl。
    ///
    ///协议原文:
    ///
    ///<pre>The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches.</pre>
    ///
    ///
    #[serde(rename = "safeUrl")]
    #[serde(
        default,
        deserialize_with = "ydp_core::binding_support::presence",
        skip_serializing_if = "Option::is_none"
    )]
    pub safe_url: Option<String>,
}
impl<'de> serde::Deserialize<'de> for SafetyTipInfo {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct Visitor;
        impl<'de> serde::de::Visitor<'de> for Visitor {
            type Value = SafetyTipInfo;
            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.write_str("协议 object")
            }
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                a: A,
            ) -> Result<Self::Value, A::Error> {
                #[derive(serde::Deserialize)]
                struct Fields {
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SafetyTipInfo/properties/safetyTipStatus。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.</pre>
                    ///
                    ///
                    #[serde(rename = "safetyTipStatus")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub safety_tip_status: crate::security::types::SafetyTipStatus,
                    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.SafetyTipInfo/properties/safeUrl。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches.</pre>
                    ///
                    ///
                    #[serde(rename = "safeUrl")]
                    #[serde(
                        default,
                        deserialize_with = "ydp_core::binding_support::presence",
                        skip_serializing_if = "Option::is_none"
                    )]
                    pub safe_url: Option<String>,
                }
                let fields = <Fields as serde::Deserialize>::deserialize(
                    serde::de::value::MapAccessDeserializer::new(a),
                )?;
                Ok(SafetyTipInfo {
                    safety_tip_status: fields.safety_tip_status,
                    safe_url: fields.safe_url,
                })
            }
        }
        d.deserialize_map(Visitor)
    }
}
///开放字符串枚举;已知值不分配 String,未知值拥有原始文本。协议来源:Security.type.SafetyTipStatus。此项为 experimental,端点可能不支持。
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum SafetyTipStatus {
    ///协议值 "badReputation"。
    BadReputation,
    ///协议值 "lookalike"。
    Lookalike,
    ///未知协议文本;Clone 复制字符串,编码保持原值。
    Unknown(String),
}
impl SafetyTipStatus {
    ///借用原始协议字符串,生命周期绑定自身。
    ///
    ///```
    ///let value = ydp::security::types::SafetyTipStatus::from(String::from("future-value"));
    ///assert_eq!(value.as_str(), "future-value");
    ///```
    pub fn as_str(&self) -> &str {
        match self {
            Self::BadReputation => "badReputation",
            Self::Lookalike => "lookalike",
            Self::Unknown(value) => value,
        }
    }
}
impl AsRef<str> for SafetyTipStatus {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}
impl From<String> for SafetyTipStatus {
    fn from(value: String) -> Self {
        match value.as_str() {
            "badReputation" => SafetyTipStatus::BadReputation,
            "lookalike" => SafetyTipStatus::Lookalike,
            _ => Self::Unknown(value),
        }
    }
}
impl serde::Serialize for SafetyTipStatus {
    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_str(self.as_str())
    }
}
impl<'de> serde::Deserialize<'de> for SafetyTipStatus {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct Visitor;
        impl<'de> serde::de::Visitor<'de> for Visitor {
            type Value = SafetyTipStatus;
            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.write_str("协议字符串枚举")
            }
            fn visit_str<E: serde::de::Error>(self, v: &str) -> Result<Self::Value, E> {
                Ok(match v {
                    "badReputation" => SafetyTipStatus::BadReputation,
                    "lookalike" => SafetyTipStatus::Lookalike,
                    _ => SafetyTipStatus::Unknown(v.to_owned()),
                })
            }
            fn visit_string<E: serde::de::Error>(self, v: String) -> Result<Self::Value, E> {
                Ok(SafetyTipStatus::from(v))
            }
        }
        d.deserialize_str(Visitor)
    }
}
///开放字符串枚举;已知值不分配 String,未知值拥有原始文本。协议来源:Security.type.SecurityState。
///
///协议原文:
///
///<pre>The security level of a page or resource.</pre>
///
///
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum SecurityState {
    ///协议值 "unknown"。
    KnownUnknown,
    ///协议值 "neutral"。
    Neutral,
    ///协议值 "insecure"。
    Insecure,
    ///协议值 "secure"。
    Secure,
    ///协议值 "info"。
    Info,
    ///协议值 "insecure-broken"。
    InsecureBroken,
    ///未知协议文本;Clone 复制字符串,编码保持原值。
    Unknown(String),
}
impl SecurityState {
    ///借用原始协议字符串,生命周期绑定自身。
    ///
    ///```
    ///let value = ydp::security::types::SecurityState::from(String::from("future-value"));
    ///assert_eq!(value.as_str(), "future-value");
    ///```
    pub fn as_str(&self) -> &str {
        match self {
            Self::KnownUnknown => "unknown",
            Self::Neutral => "neutral",
            Self::Insecure => "insecure",
            Self::Secure => "secure",
            Self::Info => "info",
            Self::InsecureBroken => "insecure-broken",
            Self::Unknown(value) => value,
        }
    }
}
impl AsRef<str> for SecurityState {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}
impl From<String> for SecurityState {
    fn from(value: String) -> Self {
        match value.as_str() {
            "unknown" => SecurityState::KnownUnknown,
            "neutral" => SecurityState::Neutral,
            "insecure" => SecurityState::Insecure,
            "secure" => SecurityState::Secure,
            "info" => SecurityState::Info,
            "insecure-broken" => SecurityState::InsecureBroken,
            _ => Self::Unknown(value),
        }
    }
}
impl serde::Serialize for SecurityState {
    fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_str(self.as_str())
    }
}
impl<'de> serde::Deserialize<'de> for SecurityState {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct Visitor;
        impl<'de> serde::de::Visitor<'de> for Visitor {
            type Value = SecurityState;
            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.write_str("协议字符串枚举")
            }
            fn visit_str<E: serde::de::Error>(self, v: &str) -> Result<Self::Value, E> {
                Ok(match v {
                    "unknown" => SecurityState::KnownUnknown,
                    "neutral" => SecurityState::Neutral,
                    "insecure" => SecurityState::Insecure,
                    "secure" => SecurityState::Secure,
                    "info" => SecurityState::Info,
                    "insecure-broken" => SecurityState::InsecureBroken,
                    _ => SecurityState::Unknown(v.to_owned()),
                })
            }
            fn visit_string<E: serde::de::Error>(self, v: String) -> Result<Self::Value, E> {
                Ok(SecurityState::from(v))
            }
        }
        d.deserialize_str(Visitor)
    }
}
///拥有型协议数据;Clone 复制字段,未知 object 字段容忍但不保留。协议来源:Security.type.SecurityStateExplanation。
///
///协议原文:
///
///<pre>An explanation of an factor contributing to the security state.</pre>
///
///
#[derive(Debug, Clone, serde::Serialize)]
pub struct SecurityStateExplanation {
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/securityState。
    ///
    ///协议原文:
    ///
    ///<pre>Security state representing the severity of the factor being explained.</pre>
    ///
    ///
    #[serde(rename = "securityState")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub security_state: crate::security::types::SecurityState,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/title。
    ///
    ///协议原文:
    ///
    ///<pre>Title describing the type of factor.</pre>
    ///
    ///
    #[serde(rename = "title")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub title: String,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/summary。
    ///
    ///协议原文:
    ///
    ///<pre>Short phrase describing the type of factor.</pre>
    ///
    ///
    #[serde(rename = "summary")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub summary: String,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/description。
    ///
    ///协议原文:
    ///
    ///<pre>Full text explanation of the factor.</pre>
    ///
    ///
    #[serde(rename = "description")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub description: String,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/mixedContentType。
    ///
    ///协议原文:
    ///
    ///<pre>The type of mixed content described by the explanation.</pre>
    ///
    ///
    #[serde(rename = "mixedContentType")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub mixed_content_type: crate::security::types::MixedContentType,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/certificate。
    ///
    ///协议原文:
    ///
    ///<pre>Page certificate.</pre>
    ///
    ///
    #[serde(rename = "certificate")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub certificate: Vec<String>,
    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.SecurityStateExplanation/properties/recommendations。
    ///
    ///协议原文:
    ///
    ///<pre>Recommendations to fix any issues.</pre>
    ///
    ///
    #[serde(rename = "recommendations")]
    #[serde(
        default,
        deserialize_with = "ydp_core::binding_support::presence",
        skip_serializing_if = "Option::is_none"
    )]
    pub recommendations: Option<Vec<String>>,
}
impl<'de> serde::Deserialize<'de> for SecurityStateExplanation {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct Visitor;
        impl<'de> serde::de::Visitor<'de> for Visitor {
            type Value = SecurityStateExplanation;
            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.write_str("协议 object")
            }
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                a: A,
            ) -> Result<Self::Value, A::Error> {
                #[derive(serde::Deserialize)]
                struct Fields {
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/securityState。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Security state representing the severity of the factor being explained.</pre>
                    ///
                    ///
                    #[serde(rename = "securityState")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub security_state: crate::security::types::SecurityState,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/title。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Title describing the type of factor.</pre>
                    ///
                    ///
                    #[serde(rename = "title")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub title: String,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/summary。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Short phrase describing the type of factor.</pre>
                    ///
                    ///
                    #[serde(rename = "summary")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub summary: String,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/description。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Full text explanation of the factor.</pre>
                    ///
                    ///
                    #[serde(rename = "description")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub description: String,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/mixedContentType。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>The type of mixed content described by the explanation.</pre>
                    ///
                    ///
                    #[serde(rename = "mixedContentType")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub mixed_content_type: crate::security::types::MixedContentType,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.SecurityStateExplanation/properties/certificate。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Page certificate.</pre>
                    ///
                    ///
                    #[serde(rename = "certificate")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub certificate: Vec<String>,
                    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.SecurityStateExplanation/properties/recommendations。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Recommendations to fix any issues.</pre>
                    ///
                    ///
                    #[serde(rename = "recommendations")]
                    #[serde(
                        default,
                        deserialize_with = "ydp_core::binding_support::presence",
                        skip_serializing_if = "Option::is_none"
                    )]
                    pub recommendations: Option<Vec<String>>,
                }
                let fields = <Fields as serde::Deserialize>::deserialize(
                    serde::de::value::MapAccessDeserializer::new(a),
                )?;
                Ok(SecurityStateExplanation {
                    security_state: fields.security_state,
                    title: fields.title,
                    summary: fields.summary,
                    description: fields.description,
                    mixed_content_type: fields.mixed_content_type,
                    certificate: fields.certificate,
                    recommendations: fields.recommendations,
                })
            }
        }
        d.deserialize_map(Visitor)
    }
}
///拥有型协议数据;Clone 复制字段,未知 object 字段容忍但不保留。协议来源:Security.type.VisibleSecurityState。
///
///协议原文:
///
///<pre>Security state information about the page.</pre>
///
///此项为 experimental,端点可能不支持。
#[derive(Debug, Clone, serde::Serialize)]
pub struct VisibleSecurityState {
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.VisibleSecurityState/properties/securityState。
    ///
    ///协议原文:
    ///
    ///<pre>The security level of the page.</pre>
    ///
    ///
    #[serde(rename = "securityState")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub security_state: crate::security::types::SecurityState,
    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.VisibleSecurityState/properties/certificateSecurityState。
    ///
    ///协议原文:
    ///
    ///<pre>Security state details about the page certificate.</pre>
    ///
    ///
    #[serde(rename = "certificateSecurityState")]
    #[serde(
        default,
        deserialize_with = "ydp_core::binding_support::presence",
        skip_serializing_if = "Option::is_none"
    )]
    pub certificate_security_state: Option<crate::security::types::CertificateSecurityState>,
    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.VisibleSecurityState/properties/safetyTipInfo。
    ///
    ///协议原文:
    ///
    ///<pre>The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown.</pre>
    ///
    ///
    #[serde(rename = "safetyTipInfo")]
    #[serde(
        default,
        deserialize_with = "ydp_core::binding_support::presence",
        skip_serializing_if = "Option::is_none"
    )]
    pub safety_tip_info: Option<crate::security::types::SafetyTipInfo>,
    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.VisibleSecurityState/properties/securityStateIssueIds。
    ///
    ///协议原文:
    ///
    ///<pre>Array of security state issues ids.</pre>
    ///
    ///
    #[serde(rename = "securityStateIssueIds")]
    #[serde(deserialize_with = "ydp_core::binding_support::required")]
    pub security_state_issue_ids: Vec<String>,
}
impl<'de> serde::Deserialize<'de> for VisibleSecurityState {
    fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<Self, D::Error> {
        struct Visitor;
        impl<'de> serde::de::Visitor<'de> for Visitor {
            type Value = VisibleSecurityState;
            fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                f.write_str("协议 object")
            }
            fn visit_map<A: serde::de::MapAccess<'de>>(
                self,
                a: A,
            ) -> Result<Self::Value, A::Error> {
                #[derive(serde::Deserialize)]
                struct Fields {
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.VisibleSecurityState/properties/securityState。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>The security level of the page.</pre>
                    ///
                    ///
                    #[serde(rename = "securityState")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub security_state: crate::security::types::SecurityState,
                    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.VisibleSecurityState/properties/certificateSecurityState。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Security state details about the page certificate.</pre>
                    ///
                    ///
                    #[serde(rename = "certificateSecurityState")]
                    #[serde(
                        default,
                        deserialize_with = "ydp_core::binding_support::presence",
                        skip_serializing_if = "Option::is_none"
                    )]
                    pub certificate_security_state:
                        Option<crate::security::types::CertificateSecurityState>,
                    ///可缺失字段;None 编码时省略,存在时按声明类型校验。协议来源:Security.type.VisibleSecurityState/properties/safetyTipInfo。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown.</pre>
                    ///
                    ///
                    #[serde(rename = "safetyTipInfo")]
                    #[serde(
                        default,
                        deserialize_with = "ydp_core::binding_support::presence",
                        skip_serializing_if = "Option::is_none"
                    )]
                    pub safety_tip_info: Option<crate::security::types::SafetyTipInfo>,
                    ///必需字段;缺失或类型错误导致解码失败。协议来源:Security.type.VisibleSecurityState/properties/securityStateIssueIds。
                    ///
                    ///协议原文:
                    ///
                    ///<pre>Array of security state issues ids.</pre>
                    ///
                    ///
                    #[serde(rename = "securityStateIssueIds")]
                    #[serde(deserialize_with = "ydp_core::binding_support::required")]
                    pub security_state_issue_ids: Vec<String>,
                }
                let fields = <Fields as serde::Deserialize>::deserialize(
                    serde::de::value::MapAccessDeserializer::new(a),
                )?;
                Ok(VisibleSecurityState {
                    security_state: fields.security_state,
                    certificate_security_state: fields.certificate_security_state,
                    safety_tip_info: fields.safety_tip_info,
                    security_state_issue_ids: fields.security_state_issue_ids,
                })
            }
        }
        d.deserialize_map(Visitor)
    }
}