browser-protocol 0.1.4

Generated Rust types and commands for the Chrome DevTools Protocol (browser-protocol)
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
use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
use std::borrow::Cow;

/// An internal certificate ID value.

pub type CertificateId = i64;

/// A description of mixed content (HTTP resources on HTTPS pages), as defined by
/// <https://www.w3.org/TR/mixed-content/#categories>

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum MixedContentType {
    #[default]
    #[serde(rename = "blockable")]
    Blockable,
    #[serde(rename = "optionally-blockable")]
    OptionallyBlockable,
    #[serde(rename = "none")]
    None,
}

/// The security level of a page or resource.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum SecurityState {
    #[default]
    #[serde(rename = "unknown")]
    Unknown,
    #[serde(rename = "neutral")]
    Neutral,
    #[serde(rename = "insecure")]
    Insecure,
    #[serde(rename = "secure")]
    Secure,
    #[serde(rename = "info")]
    Info,
    #[serde(rename = "insecure-broken")]
    InsecureBroken,
}

/// Details about the security state of the page certificate.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CertificateSecurityState<'a> {
    /// Protocol name (e.g. "TLS 1.2" or "QUIC").
    protocol: Cow<'a, str>,
    /// Key Exchange used by the connection, or the empty string if not applicable.
    #[serde(rename = "keyExchange")]
    key_exchange: Cow<'a, str>,
    /// (EC)DH group used by the connection, if applicable.
    #[serde(skip_serializing_if = "Option::is_none", rename = "keyExchangeGroup")]
    key_exchange_group: Option<Cow<'a, str>>,
    /// Cipher name.
    cipher: Cow<'a, str>,
    /// TLS MAC. Note that AEAD ciphers do not have separate MACs.
    #[serde(skip_serializing_if = "Option::is_none")]
    mac: Option<Cow<'a, str>>,
    /// Page certificate.
    certificate: Vec<Cow<'a, str>>,
    /// Certificate subject name.
    #[serde(rename = "subjectName")]
    subject_name: Cow<'a, str>,
    /// Name of the issuing CA.
    issuer: Cow<'a, str>,
    /// Certificate valid from date.
    #[serde(rename = "validFrom")]
    valid_from: crate::network::TimeSinceEpoch,
    /// Certificate valid to (expiration) date
    #[serde(rename = "validTo")]
    valid_to: crate::network::TimeSinceEpoch,
    /// The highest priority network error code, if the certificate has an error.
    #[serde(skip_serializing_if = "Option::is_none", rename = "certificateNetworkError")]
    certificate_network_error: Option<Cow<'a, str>>,
    /// True if the certificate uses a weak signature algorithm.
    #[serde(rename = "certificateHasWeakSignature")]
    certificate_has_weak_signature: bool,
    /// True if the certificate has a SHA1 signature in the chain.
    #[serde(rename = "certificateHasSha1Signature")]
    certificate_has_sha1_signature: bool,
    /// True if modern SSL
    #[serde(rename = "modernSSL")]
    modern_ssl: bool,
    /// True if the connection is using an obsolete SSL protocol.
    #[serde(rename = "obsoleteSslProtocol")]
    obsolete_ssl_protocol: bool,
    /// True if the connection is using an obsolete SSL key exchange.
    #[serde(rename = "obsoleteSslKeyExchange")]
    obsolete_ssl_key_exchange: bool,
    /// True if the connection is using an obsolete SSL cipher.
    #[serde(rename = "obsoleteSslCipher")]
    obsolete_ssl_cipher: bool,
    /// True if the connection is using an obsolete SSL signature.
    #[serde(rename = "obsoleteSslSignature")]
    obsolete_ssl_signature: bool,
}

impl<'a> CertificateSecurityState<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `protocol`: Protocol name (e.g. "TLS 1.2" or "QUIC").
    /// * `key_exchange`: Key Exchange used by the connection, or the empty string if not applicable.
    /// * `cipher`: Cipher name.
    /// * `certificate`: Page certificate.
    /// * `subject_name`: Certificate subject name.
    /// * `issuer`: Name of the issuing CA.
    /// * `valid_from`: Certificate valid from date.
    /// * `valid_to`: Certificate valid to (expiration) date
    /// * `certificate_has_weak_signature`: True if the certificate uses a weak signature algorithm.
    /// * `certificate_has_sha1_signature`: True if the certificate has a SHA1 signature in the chain.
    /// * `modern_ssl`: True if modern SSL
    /// * `obsolete_ssl_protocol`: True if the connection is using an obsolete SSL protocol.
    /// * `obsolete_ssl_key_exchange`: True if the connection is using an obsolete SSL key exchange.
    /// * `obsolete_ssl_cipher`: True if the connection is using an obsolete SSL cipher.
    /// * `obsolete_ssl_signature`: True if the connection is using an obsolete SSL signature.
    pub fn builder(protocol: impl Into<Cow<'a, str>>, key_exchange: impl Into<Cow<'a, str>>, cipher: impl Into<Cow<'a, str>>, certificate: Vec<Cow<'a, str>>, subject_name: impl Into<Cow<'a, str>>, issuer: impl Into<Cow<'a, str>>, valid_from: crate::network::TimeSinceEpoch, valid_to: crate::network::TimeSinceEpoch, certificate_has_weak_signature: bool, certificate_has_sha1_signature: bool, modern_ssl: bool, obsolete_ssl_protocol: bool, obsolete_ssl_key_exchange: bool, obsolete_ssl_cipher: bool, obsolete_ssl_signature: bool) -> CertificateSecurityStateBuilder<'a> {
        CertificateSecurityStateBuilder {
            protocol: protocol.into(),
            key_exchange: key_exchange.into(),
            key_exchange_group: None,
            cipher: cipher.into(),
            mac: None,
            certificate: certificate,
            subject_name: subject_name.into(),
            issuer: issuer.into(),
            valid_from: valid_from,
            valid_to: valid_to,
            certificate_network_error: None,
            certificate_has_weak_signature: certificate_has_weak_signature,
            certificate_has_sha1_signature: certificate_has_sha1_signature,
            modern_ssl: modern_ssl,
            obsolete_ssl_protocol: obsolete_ssl_protocol,
            obsolete_ssl_key_exchange: obsolete_ssl_key_exchange,
            obsolete_ssl_cipher: obsolete_ssl_cipher,
            obsolete_ssl_signature: obsolete_ssl_signature,
        }
    }
    /// Protocol name (e.g. "TLS 1.2" or "QUIC").
    pub fn protocol(&self) -> &str { self.protocol.as_ref() }
    /// Key Exchange used by the connection, or the empty string if not applicable.
    pub fn key_exchange(&self) -> &str { self.key_exchange.as_ref() }
    /// (EC)DH group used by the connection, if applicable.
    pub fn key_exchange_group(&self) -> Option<&str> { self.key_exchange_group.as_deref() }
    /// Cipher name.
    pub fn cipher(&self) -> &str { self.cipher.as_ref() }
    /// TLS MAC. Note that AEAD ciphers do not have separate MACs.
    pub fn mac(&self) -> Option<&str> { self.mac.as_deref() }
    /// Page certificate.
    pub fn certificate(&self) -> &[Cow<'a, str>] { &self.certificate }
    /// Certificate subject name.
    pub fn subject_name(&self) -> &str { self.subject_name.as_ref() }
    /// Name of the issuing CA.
    pub fn issuer(&self) -> &str { self.issuer.as_ref() }
    /// Certificate valid from date.
    pub fn valid_from(&self) -> &crate::network::TimeSinceEpoch { &self.valid_from }
    /// Certificate valid to (expiration) date
    pub fn valid_to(&self) -> &crate::network::TimeSinceEpoch { &self.valid_to }
    /// The highest priority network error code, if the certificate has an error.
    pub fn certificate_network_error(&self) -> Option<&str> { self.certificate_network_error.as_deref() }
    /// True if the certificate uses a weak signature algorithm.
    pub fn certificate_has_weak_signature(&self) -> bool { self.certificate_has_weak_signature }
    /// True if the certificate has a SHA1 signature in the chain.
    pub fn certificate_has_sha1_signature(&self) -> bool { self.certificate_has_sha1_signature }
    /// True if modern SSL
    pub fn modern_ssl(&self) -> bool { self.modern_ssl }
    /// True if the connection is using an obsolete SSL protocol.
    pub fn obsolete_ssl_protocol(&self) -> bool { self.obsolete_ssl_protocol }
    /// True if the connection is using an obsolete SSL key exchange.
    pub fn obsolete_ssl_key_exchange(&self) -> bool { self.obsolete_ssl_key_exchange }
    /// True if the connection is using an obsolete SSL cipher.
    pub fn obsolete_ssl_cipher(&self) -> bool { self.obsolete_ssl_cipher }
    /// True if the connection is using an obsolete SSL signature.
    pub fn obsolete_ssl_signature(&self) -> bool { self.obsolete_ssl_signature }
}


pub struct CertificateSecurityStateBuilder<'a> {
    protocol: Cow<'a, str>,
    key_exchange: Cow<'a, str>,
    key_exchange_group: Option<Cow<'a, str>>,
    cipher: Cow<'a, str>,
    mac: Option<Cow<'a, str>>,
    certificate: Vec<Cow<'a, str>>,
    subject_name: Cow<'a, str>,
    issuer: Cow<'a, str>,
    valid_from: crate::network::TimeSinceEpoch,
    valid_to: crate::network::TimeSinceEpoch,
    certificate_network_error: Option<Cow<'a, str>>,
    certificate_has_weak_signature: bool,
    certificate_has_sha1_signature: bool,
    modern_ssl: bool,
    obsolete_ssl_protocol: bool,
    obsolete_ssl_key_exchange: bool,
    obsolete_ssl_cipher: bool,
    obsolete_ssl_signature: bool,
}

impl<'a> CertificateSecurityStateBuilder<'a> {
    /// (EC)DH group used by the connection, if applicable.
    pub fn key_exchange_group(mut self, key_exchange_group: impl Into<Cow<'a, str>>) -> Self { self.key_exchange_group = Some(key_exchange_group.into()); self }
    /// TLS MAC. Note that AEAD ciphers do not have separate MACs.
    pub fn mac(mut self, mac: impl Into<Cow<'a, str>>) -> Self { self.mac = Some(mac.into()); self }
    /// The highest priority network error code, if the certificate has an error.
    pub fn certificate_network_error(mut self, certificate_network_error: impl Into<Cow<'a, str>>) -> Self { self.certificate_network_error = Some(certificate_network_error.into()); self }
    pub fn build(self) -> CertificateSecurityState<'a> {
        CertificateSecurityState {
            protocol: self.protocol,
            key_exchange: self.key_exchange,
            key_exchange_group: self.key_exchange_group,
            cipher: self.cipher,
            mac: self.mac,
            certificate: self.certificate,
            subject_name: self.subject_name,
            issuer: self.issuer,
            valid_from: self.valid_from,
            valid_to: self.valid_to,
            certificate_network_error: self.certificate_network_error,
            certificate_has_weak_signature: self.certificate_has_weak_signature,
            certificate_has_sha1_signature: self.certificate_has_sha1_signature,
            modern_ssl: self.modern_ssl,
            obsolete_ssl_protocol: self.obsolete_ssl_protocol,
            obsolete_ssl_key_exchange: self.obsolete_ssl_key_exchange,
            obsolete_ssl_cipher: self.obsolete_ssl_cipher,
            obsolete_ssl_signature: self.obsolete_ssl_signature,
        }
    }
}


#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum SafetyTipStatus {
    #[default]
    #[serde(rename = "badReputation")]
    BadReputation,
    #[serde(rename = "lookalike")]
    Lookalike,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SafetyTipInfo<'a> {
    /// Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.
    #[serde(rename = "safetyTipStatus")]
    safety_tip_status: SafetyTipStatus,
    /// The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches.
    #[serde(skip_serializing_if = "Option::is_none", rename = "safeUrl")]
    safe_url: Option<Cow<'a, str>>,
}

impl<'a> SafetyTipInfo<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `safety_tip_status`: Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.
    pub fn builder(safety_tip_status: impl Into<SafetyTipStatus>) -> SafetyTipInfoBuilder<'a> {
        SafetyTipInfoBuilder {
            safety_tip_status: safety_tip_status.into(),
            safe_url: None,
        }
    }
    /// Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.
    pub fn safety_tip_status(&self) -> &SafetyTipStatus { &self.safety_tip_status }
    /// The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches.
    pub fn safe_url(&self) -> Option<&str> { self.safe_url.as_deref() }
}


pub struct SafetyTipInfoBuilder<'a> {
    safety_tip_status: SafetyTipStatus,
    safe_url: Option<Cow<'a, str>>,
}

impl<'a> SafetyTipInfoBuilder<'a> {
    /// The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches.
    pub fn safe_url(mut self, safe_url: impl Into<Cow<'a, str>>) -> Self { self.safe_url = Some(safe_url.into()); self }
    pub fn build(self) -> SafetyTipInfo<'a> {
        SafetyTipInfo {
            safety_tip_status: self.safety_tip_status,
            safe_url: self.safe_url,
        }
    }
}

/// Security state information about the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct VisibleSecurityState<'a> {
    /// The security level of the page.
    #[serde(rename = "securityState")]
    security_state: SecurityState,
    /// Security state details about the page certificate.
    #[serde(skip_serializing_if = "Option::is_none", rename = "certificateSecurityState")]
    certificate_security_state: Option<CertificateSecurityState<'a>>,
    /// 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.
    #[serde(skip_serializing_if = "Option::is_none", rename = "safetyTipInfo")]
    safety_tip_info: Option<SafetyTipInfo<'a>>,
    /// Array of security state issues ids.
    #[serde(rename = "securityStateIssueIds")]
    security_state_issue_ids: Vec<Cow<'a, str>>,
}

impl<'a> VisibleSecurityState<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `security_state`: The security level of the page.
    /// * `security_state_issue_ids`: Array of security state issues ids.
    pub fn builder(security_state: impl Into<SecurityState>, security_state_issue_ids: Vec<Cow<'a, str>>) -> VisibleSecurityStateBuilder<'a> {
        VisibleSecurityStateBuilder {
            security_state: security_state.into(),
            certificate_security_state: None,
            safety_tip_info: None,
            security_state_issue_ids: security_state_issue_ids,
        }
    }
    /// The security level of the page.
    pub fn security_state(&self) -> &SecurityState { &self.security_state }
    /// Security state details about the page certificate.
    pub fn certificate_security_state(&self) -> Option<&CertificateSecurityState<'a>> { self.certificate_security_state.as_ref() }
    /// 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.
    pub fn safety_tip_info(&self) -> Option<&SafetyTipInfo<'a>> { self.safety_tip_info.as_ref() }
    /// Array of security state issues ids.
    pub fn security_state_issue_ids(&self) -> &[Cow<'a, str>] { &self.security_state_issue_ids }
}


pub struct VisibleSecurityStateBuilder<'a> {
    security_state: SecurityState,
    certificate_security_state: Option<CertificateSecurityState<'a>>,
    safety_tip_info: Option<SafetyTipInfo<'a>>,
    security_state_issue_ids: Vec<Cow<'a, str>>,
}

impl<'a> VisibleSecurityStateBuilder<'a> {
    /// Security state details about the page certificate.
    pub fn certificate_security_state(mut self, certificate_security_state: CertificateSecurityState<'a>) -> Self { self.certificate_security_state = Some(certificate_security_state); self }
    /// 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.
    pub fn safety_tip_info(mut self, safety_tip_info: SafetyTipInfo<'a>) -> Self { self.safety_tip_info = Some(safety_tip_info); self }
    pub fn build(self) -> VisibleSecurityState<'a> {
        VisibleSecurityState {
            security_state: self.security_state,
            certificate_security_state: self.certificate_security_state,
            safety_tip_info: self.safety_tip_info,
            security_state_issue_ids: self.security_state_issue_ids,
        }
    }
}

/// An explanation of an factor contributing to the security state.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SecurityStateExplanation<'a> {
    /// Security state representing the severity of the factor being explained.
    #[serde(rename = "securityState")]
    security_state: SecurityState,
    /// Title describing the type of factor.
    title: Cow<'a, str>,
    /// Short phrase describing the type of factor.
    summary: Cow<'a, str>,
    /// Full text explanation of the factor.
    description: Cow<'a, str>,
    /// The type of mixed content described by the explanation.
    #[serde(rename = "mixedContentType")]
    mixed_content_type: MixedContentType,
    /// Page certificate.
    certificate: Vec<Cow<'a, str>>,
    /// Recommendations to fix any issues.
    #[serde(skip_serializing_if = "Option::is_none")]
    recommendations: Option<Vec<Cow<'a, str>>>,
}

impl<'a> SecurityStateExplanation<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `security_state`: Security state representing the severity of the factor being explained.
    /// * `title`: Title describing the type of factor.
    /// * `summary`: Short phrase describing the type of factor.
    /// * `description`: Full text explanation of the factor.
    /// * `mixed_content_type`: The type of mixed content described by the explanation.
    /// * `certificate`: Page certificate.
    pub fn builder(security_state: impl Into<SecurityState>, title: impl Into<Cow<'a, str>>, summary: impl Into<Cow<'a, str>>, description: impl Into<Cow<'a, str>>, mixed_content_type: impl Into<MixedContentType>, certificate: Vec<Cow<'a, str>>) -> SecurityStateExplanationBuilder<'a> {
        SecurityStateExplanationBuilder {
            security_state: security_state.into(),
            title: title.into(),
            summary: summary.into(),
            description: description.into(),
            mixed_content_type: mixed_content_type.into(),
            certificate: certificate,
            recommendations: None,
        }
    }
    /// Security state representing the severity of the factor being explained.
    pub fn security_state(&self) -> &SecurityState { &self.security_state }
    /// Title describing the type of factor.
    pub fn title(&self) -> &str { self.title.as_ref() }
    /// Short phrase describing the type of factor.
    pub fn summary(&self) -> &str { self.summary.as_ref() }
    /// Full text explanation of the factor.
    pub fn description(&self) -> &str { self.description.as_ref() }
    /// The type of mixed content described by the explanation.
    pub fn mixed_content_type(&self) -> &MixedContentType { &self.mixed_content_type }
    /// Page certificate.
    pub fn certificate(&self) -> &[Cow<'a, str>] { &self.certificate }
    /// Recommendations to fix any issues.
    pub fn recommendations(&self) -> Option<&[Cow<'a, str>]> { self.recommendations.as_deref() }
}


pub struct SecurityStateExplanationBuilder<'a> {
    security_state: SecurityState,
    title: Cow<'a, str>,
    summary: Cow<'a, str>,
    description: Cow<'a, str>,
    mixed_content_type: MixedContentType,
    certificate: Vec<Cow<'a, str>>,
    recommendations: Option<Vec<Cow<'a, str>>>,
}

impl<'a> SecurityStateExplanationBuilder<'a> {
    /// Recommendations to fix any issues.
    pub fn recommendations(mut self, recommendations: Vec<Cow<'a, str>>) -> Self { self.recommendations = Some(recommendations); self }
    pub fn build(self) -> SecurityStateExplanation<'a> {
        SecurityStateExplanation {
            security_state: self.security_state,
            title: self.title,
            summary: self.summary,
            description: self.description,
            mixed_content_type: self.mixed_content_type,
            certificate: self.certificate,
            recommendations: self.recommendations,
        }
    }
}

/// Information about insecure content on the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct InsecureContentStatus {
    /// Always false.
    #[serde(rename = "ranMixedContent")]
    ran_mixed_content: bool,
    /// Always false.
    #[serde(rename = "displayedMixedContent")]
    displayed_mixed_content: bool,
    /// Always false.
    #[serde(rename = "containedMixedForm")]
    contained_mixed_form: bool,
    /// Always false.
    #[serde(rename = "ranContentWithCertErrors")]
    ran_content_with_cert_errors: bool,
    /// Always false.
    #[serde(rename = "displayedContentWithCertErrors")]
    displayed_content_with_cert_errors: bool,
    /// Always set to unknown.
    #[serde(rename = "ranInsecureContentStyle")]
    ran_insecure_content_style: SecurityState,
    /// Always set to unknown.
    #[serde(rename = "displayedInsecureContentStyle")]
    displayed_insecure_content_style: SecurityState,
}

impl InsecureContentStatus {
    /// Creates a builder for this type with the required parameters:
    /// * `ran_mixed_content`: Always false.
    /// * `displayed_mixed_content`: Always false.
    /// * `contained_mixed_form`: Always false.
    /// * `ran_content_with_cert_errors`: Always false.
    /// * `displayed_content_with_cert_errors`: Always false.
    /// * `ran_insecure_content_style`: Always set to unknown.
    /// * `displayed_insecure_content_style`: Always set to unknown.
    pub fn builder(ran_mixed_content: bool, displayed_mixed_content: bool, contained_mixed_form: bool, ran_content_with_cert_errors: bool, displayed_content_with_cert_errors: bool, ran_insecure_content_style: impl Into<SecurityState>, displayed_insecure_content_style: impl Into<SecurityState>) -> InsecureContentStatusBuilder {
        InsecureContentStatusBuilder {
            ran_mixed_content: ran_mixed_content,
            displayed_mixed_content: displayed_mixed_content,
            contained_mixed_form: contained_mixed_form,
            ran_content_with_cert_errors: ran_content_with_cert_errors,
            displayed_content_with_cert_errors: displayed_content_with_cert_errors,
            ran_insecure_content_style: ran_insecure_content_style.into(),
            displayed_insecure_content_style: displayed_insecure_content_style.into(),
        }
    }
    /// Always false.
    pub fn ran_mixed_content(&self) -> bool { self.ran_mixed_content }
    /// Always false.
    pub fn displayed_mixed_content(&self) -> bool { self.displayed_mixed_content }
    /// Always false.
    pub fn contained_mixed_form(&self) -> bool { self.contained_mixed_form }
    /// Always false.
    pub fn ran_content_with_cert_errors(&self) -> bool { self.ran_content_with_cert_errors }
    /// Always false.
    pub fn displayed_content_with_cert_errors(&self) -> bool { self.displayed_content_with_cert_errors }
    /// Always set to unknown.
    pub fn ran_insecure_content_style(&self) -> &SecurityState { &self.ran_insecure_content_style }
    /// Always set to unknown.
    pub fn displayed_insecure_content_style(&self) -> &SecurityState { &self.displayed_insecure_content_style }
}


pub struct InsecureContentStatusBuilder {
    ran_mixed_content: bool,
    displayed_mixed_content: bool,
    contained_mixed_form: bool,
    ran_content_with_cert_errors: bool,
    displayed_content_with_cert_errors: bool,
    ran_insecure_content_style: SecurityState,
    displayed_insecure_content_style: SecurityState,
}

impl InsecureContentStatusBuilder {
    pub fn build(self) -> InsecureContentStatus {
        InsecureContentStatus {
            ran_mixed_content: self.ran_mixed_content,
            displayed_mixed_content: self.displayed_mixed_content,
            contained_mixed_form: self.contained_mixed_form,
            ran_content_with_cert_errors: self.ran_content_with_cert_errors,
            displayed_content_with_cert_errors: self.displayed_content_with_cert_errors,
            ran_insecure_content_style: self.ran_insecure_content_style,
            displayed_insecure_content_style: self.displayed_insecure_content_style,
        }
    }
}

/// The action to take when a certificate error occurs. continue will continue processing the
/// request and cancel will cancel the request.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum CertificateErrorAction {
    #[default]
    #[serde(rename = "continue")]
    Continue,
    #[serde(rename = "cancel")]
    Cancel,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}

impl DisableParams { pub const METHOD: &'static str = "Security.disable"; }

impl<'a> crate::CdpCommand<'a> for DisableParams {
    const METHOD: &'static str = "Security.disable";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct EnableParams {}

impl EnableParams { pub const METHOD: &'static str = "Security.enable"; }

impl<'a> crate::CdpCommand<'a> for EnableParams {
    const METHOD: &'static str = "Security.enable";
    type Response = crate::EmptyReturns;
}

/// Enable/disable whether all certificate errors should be ignored.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetIgnoreCertificateErrorsParams {
    /// If true, all certificate errors will be ignored.
    ignore: bool,
}

impl SetIgnoreCertificateErrorsParams {
    /// Creates a builder for this type with the required parameters:
    /// * `ignore`: If true, all certificate errors will be ignored.
    pub fn builder(ignore: bool) -> SetIgnoreCertificateErrorsParamsBuilder {
        SetIgnoreCertificateErrorsParamsBuilder {
            ignore: ignore,
        }
    }
    /// If true, all certificate errors will be ignored.
    pub fn ignore(&self) -> bool { self.ignore }
}


pub struct SetIgnoreCertificateErrorsParamsBuilder {
    ignore: bool,
}

impl SetIgnoreCertificateErrorsParamsBuilder {
    pub fn build(self) -> SetIgnoreCertificateErrorsParams {
        SetIgnoreCertificateErrorsParams {
            ignore: self.ignore,
        }
    }
}

impl SetIgnoreCertificateErrorsParams { pub const METHOD: &'static str = "Security.setIgnoreCertificateErrors"; }

impl<'a> crate::CdpCommand<'a> for SetIgnoreCertificateErrorsParams {
    const METHOD: &'static str = "Security.setIgnoreCertificateErrors";
    type Response = crate::EmptyReturns;
}

/// Handles a certificate error that fired a certificateError event.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct HandleCertificateErrorParams {
    /// The ID of the event.
    #[serde(rename = "eventId")]
    event_id: u64,
    /// The action to take on the certificate error.
    action: CertificateErrorAction,
}

impl HandleCertificateErrorParams {
    /// Creates a builder for this type with the required parameters:
    /// * `event_id`: The ID of the event.
    /// * `action`: The action to take on the certificate error.
    pub fn builder(event_id: u64, action: impl Into<CertificateErrorAction>) -> HandleCertificateErrorParamsBuilder {
        HandleCertificateErrorParamsBuilder {
            event_id: event_id,
            action: action.into(),
        }
    }
    /// The ID of the event.
    pub fn event_id(&self) -> u64 { self.event_id }
    /// The action to take on the certificate error.
    pub fn action(&self) -> &CertificateErrorAction { &self.action }
}


pub struct HandleCertificateErrorParamsBuilder {
    event_id: u64,
    action: CertificateErrorAction,
}

impl HandleCertificateErrorParamsBuilder {
    pub fn build(self) -> HandleCertificateErrorParams {
        HandleCertificateErrorParams {
            event_id: self.event_id,
            action: self.action,
        }
    }
}

impl HandleCertificateErrorParams { pub const METHOD: &'static str = "Security.handleCertificateError"; }

impl<'a> crate::CdpCommand<'a> for HandleCertificateErrorParams {
    const METHOD: &'static str = "Security.handleCertificateError";
    type Response = crate::EmptyReturns;
}

/// Enable/disable overriding certificate errors. If enabled, all certificate error events need to
/// be handled by the DevTools client and should be answered with 'handleCertificateError' commands.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetOverrideCertificateErrorsParams {
    /// If true, certificate errors will be overridden.
    #[serde(rename = "override")]
    override_: bool,
}

impl SetOverrideCertificateErrorsParams {
    /// Creates a builder for this type with the required parameters:
    /// * `override_`: If true, certificate errors will be overridden.
    pub fn builder(override_: bool) -> SetOverrideCertificateErrorsParamsBuilder {
        SetOverrideCertificateErrorsParamsBuilder {
            override_: override_,
        }
    }
    /// If true, certificate errors will be overridden.
    pub fn override_(&self) -> bool { self.override_ }
}


pub struct SetOverrideCertificateErrorsParamsBuilder {
    override_: bool,
}

impl SetOverrideCertificateErrorsParamsBuilder {
    pub fn build(self) -> SetOverrideCertificateErrorsParams {
        SetOverrideCertificateErrorsParams {
            override_: self.override_,
        }
    }
}

impl SetOverrideCertificateErrorsParams { pub const METHOD: &'static str = "Security.setOverrideCertificateErrors"; }

impl<'a> crate::CdpCommand<'a> for SetOverrideCertificateErrorsParams {
    const METHOD: &'static str = "Security.setOverrideCertificateErrors";
    type Response = crate::EmptyReturns;
}