Skip to main content

browser_protocol/emulation/
mod.rs

1//! This domain emulates different environments for the page.
2
3
4use serde::{Serialize, Deserialize};
5use serde_json::Value as JsonValue;
6use std::borrow::Cow;
7
8
9#[derive(Debug, Clone, Serialize, Deserialize, Default)]
10#[serde(rename_all = "camelCase")]
11pub struct SafeAreaInsets {
12    /// Overrides safe-area-inset-top.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    top: Option<i64>,
15    /// Overrides safe-area-max-inset-top.
16    #[serde(skip_serializing_if = "Option::is_none", rename = "topMax")]
17    top_max: Option<i64>,
18    /// Overrides safe-area-inset-left.
19    #[serde(skip_serializing_if = "Option::is_none")]
20    left: Option<i64>,
21    /// Overrides safe-area-max-inset-left.
22    #[serde(skip_serializing_if = "Option::is_none", rename = "leftMax")]
23    left_max: Option<i64>,
24    /// Overrides safe-area-inset-bottom.
25    #[serde(skip_serializing_if = "Option::is_none")]
26    bottom: Option<i64>,
27    /// Overrides safe-area-max-inset-bottom.
28    #[serde(skip_serializing_if = "Option::is_none", rename = "bottomMax")]
29    bottom_max: Option<i64>,
30    /// Overrides safe-area-inset-right.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    right: Option<i64>,
33    /// Overrides safe-area-max-inset-right.
34    #[serde(skip_serializing_if = "Option::is_none", rename = "rightMax")]
35    right_max: Option<i64>,
36}
37
38impl SafeAreaInsets {
39    /// Creates a builder for this type.
40    pub fn builder() -> SafeAreaInsetsBuilder {
41        SafeAreaInsetsBuilder {
42            top: None,
43            top_max: None,
44            left: None,
45            left_max: None,
46            bottom: None,
47            bottom_max: None,
48            right: None,
49            right_max: None,
50        }
51    }
52    /// Overrides safe-area-inset-top.
53    pub fn top(&self) -> Option<i64> { self.top }
54    /// Overrides safe-area-max-inset-top.
55    pub fn top_max(&self) -> Option<i64> { self.top_max }
56    /// Overrides safe-area-inset-left.
57    pub fn left(&self) -> Option<i64> { self.left }
58    /// Overrides safe-area-max-inset-left.
59    pub fn left_max(&self) -> Option<i64> { self.left_max }
60    /// Overrides safe-area-inset-bottom.
61    pub fn bottom(&self) -> Option<i64> { self.bottom }
62    /// Overrides safe-area-max-inset-bottom.
63    pub fn bottom_max(&self) -> Option<i64> { self.bottom_max }
64    /// Overrides safe-area-inset-right.
65    pub fn right(&self) -> Option<i64> { self.right }
66    /// Overrides safe-area-max-inset-right.
67    pub fn right_max(&self) -> Option<i64> { self.right_max }
68}
69
70#[derive(Default)]
71pub struct SafeAreaInsetsBuilder {
72    top: Option<i64>,
73    top_max: Option<i64>,
74    left: Option<i64>,
75    left_max: Option<i64>,
76    bottom: Option<i64>,
77    bottom_max: Option<i64>,
78    right: Option<i64>,
79    right_max: Option<i64>,
80}
81
82impl SafeAreaInsetsBuilder {
83    /// Overrides safe-area-inset-top.
84    pub fn top(mut self, top: i64) -> Self { self.top = Some(top); self }
85    /// Overrides safe-area-max-inset-top.
86    pub fn top_max(mut self, top_max: i64) -> Self { self.top_max = Some(top_max); self }
87    /// Overrides safe-area-inset-left.
88    pub fn left(mut self, left: i64) -> Self { self.left = Some(left); self }
89    /// Overrides safe-area-max-inset-left.
90    pub fn left_max(mut self, left_max: i64) -> Self { self.left_max = Some(left_max); self }
91    /// Overrides safe-area-inset-bottom.
92    pub fn bottom(mut self, bottom: i64) -> Self { self.bottom = Some(bottom); self }
93    /// Overrides safe-area-max-inset-bottom.
94    pub fn bottom_max(mut self, bottom_max: i64) -> Self { self.bottom_max = Some(bottom_max); self }
95    /// Overrides safe-area-inset-right.
96    pub fn right(mut self, right: i64) -> Self { self.right = Some(right); self }
97    /// Overrides safe-area-max-inset-right.
98    pub fn right_max(mut self, right_max: i64) -> Self { self.right_max = Some(right_max); self }
99    pub fn build(self) -> SafeAreaInsets {
100        SafeAreaInsets {
101            top: self.top,
102            top_max: self.top_max,
103            left: self.left,
104            left_max: self.left_max,
105            bottom: self.bottom,
106            bottom_max: self.bottom_max,
107            right: self.right,
108            right_max: self.right_max,
109        }
110    }
111}
112
113/// Screen orientation.
114
115#[derive(Debug, Clone, Serialize, Deserialize, Default)]
116#[serde(rename_all = "camelCase")]
117pub struct ScreenOrientation<'a> {
118    /// Orientation type.
119    #[serde(rename = "type")]
120    type_: Cow<'a, str>,
121    /// Orientation angle.
122    angle: i64,
123}
124
125impl<'a> ScreenOrientation<'a> {
126    /// Creates a builder for this type with the required parameters:
127    /// * `type_`: Orientation type.
128    /// * `angle`: Orientation angle.
129    pub fn builder(type_: impl Into<Cow<'a, str>>, angle: i64) -> ScreenOrientationBuilder<'a> {
130        ScreenOrientationBuilder {
131            type_: type_.into(),
132            angle: angle,
133        }
134    }
135    /// Orientation type.
136    pub fn type_(&self) -> &str { self.type_.as_ref() }
137    /// Orientation angle.
138    pub fn angle(&self) -> i64 { self.angle }
139}
140
141
142pub struct ScreenOrientationBuilder<'a> {
143    type_: Cow<'a, str>,
144    angle: i64,
145}
146
147impl<'a> ScreenOrientationBuilder<'a> {
148    pub fn build(self) -> ScreenOrientation<'a> {
149        ScreenOrientation {
150            type_: self.type_,
151            angle: self.angle,
152        }
153    }
154}
155
156
157#[derive(Debug, Clone, Serialize, Deserialize, Default)]
158#[serde(rename_all = "camelCase")]
159pub struct DisplayFeature<'a> {
160    /// Orientation of a display feature in relation to screen
161    orientation: Cow<'a, str>,
162    /// The offset from the screen origin in either the x (for vertical
163    /// orientation) or y (for horizontal orientation) direction.
164    offset: i32,
165    /// A display feature may mask content such that it is not physically
166    /// displayed - this length along with the offset describes this area.
167    /// A display feature that only splits content will have a 0 mask_length.
168    #[serde(rename = "maskLength")]
169    mask_length: u64,
170}
171
172impl<'a> DisplayFeature<'a> {
173    /// Creates a builder for this type with the required parameters:
174    /// * `orientation`: Orientation of a display feature in relation to screen
175    /// * `offset`: The offset from the screen origin in either the x (for vertical orientation) or y (for horizontal orientation) direction.
176    /// * `mask_length`: A display feature may mask content such that it is not physically displayed - this length along with the offset describes this area. A display feature that only splits content will have a 0 mask_length.
177    pub fn builder(orientation: impl Into<Cow<'a, str>>, offset: i32, mask_length: u64) -> DisplayFeatureBuilder<'a> {
178        DisplayFeatureBuilder {
179            orientation: orientation.into(),
180            offset: offset,
181            mask_length: mask_length,
182        }
183    }
184    /// Orientation of a display feature in relation to screen
185    pub fn orientation(&self) -> &str { self.orientation.as_ref() }
186    /// The offset from the screen origin in either the x (for vertical
187    /// orientation) or y (for horizontal orientation) direction.
188    pub fn offset(&self) -> i32 { self.offset }
189    /// A display feature may mask content such that it is not physically
190    /// displayed - this length along with the offset describes this area.
191    /// A display feature that only splits content will have a 0 mask_length.
192    pub fn mask_length(&self) -> u64 { self.mask_length }
193}
194
195
196pub struct DisplayFeatureBuilder<'a> {
197    orientation: Cow<'a, str>,
198    offset: i32,
199    mask_length: u64,
200}
201
202impl<'a> DisplayFeatureBuilder<'a> {
203    pub fn build(self) -> DisplayFeature<'a> {
204        DisplayFeature {
205            orientation: self.orientation,
206            offset: self.offset,
207            mask_length: self.mask_length,
208        }
209    }
210}
211
212
213#[derive(Debug, Clone, Serialize, Deserialize, Default)]
214#[serde(rename_all = "camelCase")]
215pub struct DevicePosture<'a> {
216    /// Current posture of the device
217    #[serde(rename = "type")]
218    type_: Cow<'a, str>,
219}
220
221impl<'a> DevicePosture<'a> {
222    /// Creates a builder for this type with the required parameters:
223    /// * `type_`: Current posture of the device
224    pub fn builder(type_: impl Into<Cow<'a, str>>) -> DevicePostureBuilder<'a> {
225        DevicePostureBuilder {
226            type_: type_.into(),
227        }
228    }
229    /// Current posture of the device
230    pub fn type_(&self) -> &str { self.type_.as_ref() }
231}
232
233
234pub struct DevicePostureBuilder<'a> {
235    type_: Cow<'a, str>,
236}
237
238impl<'a> DevicePostureBuilder<'a> {
239    pub fn build(self) -> DevicePosture<'a> {
240        DevicePosture {
241            type_: self.type_,
242        }
243    }
244}
245
246
247#[derive(Debug, Clone, Serialize, Deserialize, Default)]
248#[serde(rename_all = "camelCase")]
249pub struct MediaFeature<'a> {
250    name: Cow<'a, str>,
251    value: Cow<'a, str>,
252}
253
254impl<'a> MediaFeature<'a> {
255    /// Creates a builder for this type with the required parameters:
256    /// * `name`: 
257    /// * `value`: 
258    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> MediaFeatureBuilder<'a> {
259        MediaFeatureBuilder {
260            name: name.into(),
261            value: value.into(),
262        }
263    }
264    pub fn name(&self) -> &str { self.name.as_ref() }
265    pub fn value(&self) -> &str { self.value.as_ref() }
266}
267
268
269pub struct MediaFeatureBuilder<'a> {
270    name: Cow<'a, str>,
271    value: Cow<'a, str>,
272}
273
274impl<'a> MediaFeatureBuilder<'a> {
275    pub fn build(self) -> MediaFeature<'a> {
276        MediaFeature {
277            name: self.name,
278            value: self.value,
279        }
280    }
281}
282
283/// advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to
284/// allow the next delayed task (if any) to run; pause: The virtual time base may not advance;
285/// pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending
286/// resource fetches.
287
288#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
289pub enum VirtualTimePolicy {
290    #[default]
291    #[serde(rename = "advance")]
292    Advance,
293    #[serde(rename = "pause")]
294    Pause,
295    #[serde(rename = "pauseIfNetworkFetchesPending")]
296    PauseIfNetworkFetchesPending,
297}
298
299/// Used to specify User Agent Client Hints to emulate. See <https://wicg.github.io/ua-client-hints>
300
301#[derive(Debug, Clone, Serialize, Deserialize, Default)]
302#[serde(rename_all = "camelCase")]
303pub struct UserAgentBrandVersion<'a> {
304    brand: Cow<'a, str>,
305    version: Cow<'a, str>,
306}
307
308impl<'a> UserAgentBrandVersion<'a> {
309    /// Creates a builder for this type with the required parameters:
310    /// * `brand`: 
311    /// * `version`: 
312    pub fn builder(brand: impl Into<Cow<'a, str>>, version: impl Into<Cow<'a, str>>) -> UserAgentBrandVersionBuilder<'a> {
313        UserAgentBrandVersionBuilder {
314            brand: brand.into(),
315            version: version.into(),
316        }
317    }
318    pub fn brand(&self) -> &str { self.brand.as_ref() }
319    pub fn version(&self) -> &str { self.version.as_ref() }
320}
321
322
323pub struct UserAgentBrandVersionBuilder<'a> {
324    brand: Cow<'a, str>,
325    version: Cow<'a, str>,
326}
327
328impl<'a> UserAgentBrandVersionBuilder<'a> {
329    pub fn build(self) -> UserAgentBrandVersion<'a> {
330        UserAgentBrandVersion {
331            brand: self.brand,
332            version: self.version,
333        }
334    }
335}
336
337/// Used to specify User Agent Client Hints to emulate. See <https://wicg.github.io/ua-client-hints>
338/// Missing optional values will be filled in by the target with what it would normally use.
339
340#[derive(Debug, Clone, Serialize, Deserialize, Default)]
341#[serde(rename_all = "camelCase")]
342pub struct UserAgentMetadata<'a> {
343    /// Brands appearing in Sec-CH-UA.
344    #[serde(skip_serializing_if = "Option::is_none")]
345    brands: Option<Vec<UserAgentBrandVersion<'a>>>,
346    /// Brands appearing in Sec-CH-UA-Full-Version-List.
347    #[serde(skip_serializing_if = "Option::is_none", rename = "fullVersionList")]
348    full_version_list: Option<Vec<UserAgentBrandVersion<'a>>>,
349    #[serde(skip_serializing_if = "Option::is_none", rename = "fullVersion")]
350    full_version: Option<Cow<'a, str>>,
351    platform: Cow<'a, str>,
352    #[serde(rename = "platformVersion")]
353    platform_version: Cow<'a, str>,
354    architecture: Cow<'a, str>,
355    model: Cow<'a, str>,
356    mobile: bool,
357    #[serde(skip_serializing_if = "Option::is_none")]
358    bitness: Option<Cow<'a, str>>,
359    #[serde(skip_serializing_if = "Option::is_none")]
360    wow64: Option<bool>,
361    /// Used to specify User Agent form-factor values.
362    /// See <https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors>
363    #[serde(skip_serializing_if = "Option::is_none", rename = "formFactors")]
364    form_factors: Option<Vec<Cow<'a, str>>>,
365}
366
367impl<'a> UserAgentMetadata<'a> {
368    /// Creates a builder for this type with the required parameters:
369    /// * `platform`: 
370    /// * `platform_version`: 
371    /// * `architecture`: 
372    /// * `model`: 
373    /// * `mobile`: 
374    pub fn builder(platform: impl Into<Cow<'a, str>>, platform_version: impl Into<Cow<'a, str>>, architecture: impl Into<Cow<'a, str>>, model: impl Into<Cow<'a, str>>, mobile: bool) -> UserAgentMetadataBuilder<'a> {
375        UserAgentMetadataBuilder {
376            brands: None,
377            full_version_list: None,
378            full_version: None,
379            platform: platform.into(),
380            platform_version: platform_version.into(),
381            architecture: architecture.into(),
382            model: model.into(),
383            mobile: mobile,
384            bitness: None,
385            wow64: None,
386            form_factors: None,
387        }
388    }
389    /// Brands appearing in Sec-CH-UA.
390    pub fn brands(&self) -> Option<&[UserAgentBrandVersion<'a>]> { self.brands.as_deref() }
391    /// Brands appearing in Sec-CH-UA-Full-Version-List.
392    pub fn full_version_list(&self) -> Option<&[UserAgentBrandVersion<'a>]> { self.full_version_list.as_deref() }
393    pub fn full_version(&self) -> Option<&str> { self.full_version.as_deref() }
394    pub fn platform(&self) -> &str { self.platform.as_ref() }
395    pub fn platform_version(&self) -> &str { self.platform_version.as_ref() }
396    pub fn architecture(&self) -> &str { self.architecture.as_ref() }
397    pub fn model(&self) -> &str { self.model.as_ref() }
398    pub fn mobile(&self) -> bool { self.mobile }
399    pub fn bitness(&self) -> Option<&str> { self.bitness.as_deref() }
400    pub fn wow64(&self) -> Option<bool> { self.wow64 }
401    /// Used to specify User Agent form-factor values.
402    /// See <https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors>
403    pub fn form_factors(&self) -> Option<&[Cow<'a, str>]> { self.form_factors.as_deref() }
404}
405
406
407pub struct UserAgentMetadataBuilder<'a> {
408    brands: Option<Vec<UserAgentBrandVersion<'a>>>,
409    full_version_list: Option<Vec<UserAgentBrandVersion<'a>>>,
410    full_version: Option<Cow<'a, str>>,
411    platform: Cow<'a, str>,
412    platform_version: Cow<'a, str>,
413    architecture: Cow<'a, str>,
414    model: Cow<'a, str>,
415    mobile: bool,
416    bitness: Option<Cow<'a, str>>,
417    wow64: Option<bool>,
418    form_factors: Option<Vec<Cow<'a, str>>>,
419}
420
421impl<'a> UserAgentMetadataBuilder<'a> {
422    /// Brands appearing in Sec-CH-UA.
423    pub fn brands(mut self, brands: Vec<UserAgentBrandVersion<'a>>) -> Self { self.brands = Some(brands); self }
424    /// Brands appearing in Sec-CH-UA-Full-Version-List.
425    pub fn full_version_list(mut self, full_version_list: Vec<UserAgentBrandVersion<'a>>) -> Self { self.full_version_list = Some(full_version_list); self }
426    pub fn full_version(mut self, full_version: impl Into<Cow<'a, str>>) -> Self { self.full_version = Some(full_version.into()); self }
427    pub fn bitness(mut self, bitness: impl Into<Cow<'a, str>>) -> Self { self.bitness = Some(bitness.into()); self }
428    pub fn wow64(mut self, wow64: bool) -> Self { self.wow64 = Some(wow64); self }
429    /// Used to specify User Agent form-factor values.
430    /// See <https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors>
431    pub fn form_factors(mut self, form_factors: Vec<Cow<'a, str>>) -> Self { self.form_factors = Some(form_factors); self }
432    pub fn build(self) -> UserAgentMetadata<'a> {
433        UserAgentMetadata {
434            brands: self.brands,
435            full_version_list: self.full_version_list,
436            full_version: self.full_version,
437            platform: self.platform,
438            platform_version: self.platform_version,
439            architecture: self.architecture,
440            model: self.model,
441            mobile: self.mobile,
442            bitness: self.bitness,
443            wow64: self.wow64,
444            form_factors: self.form_factors,
445        }
446    }
447}
448
449/// Used to specify sensor types to emulate.
450/// See <https://w3c.github.io/sensors/#automation> for more information.
451
452#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
453pub enum SensorType {
454    #[default]
455    #[serde(rename = "absolute-orientation")]
456    AbsoluteOrientation,
457    #[serde(rename = "accelerometer")]
458    Accelerometer,
459    #[serde(rename = "ambient-light")]
460    AmbientLight,
461    #[serde(rename = "gravity")]
462    Gravity,
463    #[serde(rename = "gyroscope")]
464    Gyroscope,
465    #[serde(rename = "linear-acceleration")]
466    LinearAcceleration,
467    #[serde(rename = "magnetometer")]
468    Magnetometer,
469    #[serde(rename = "relative-orientation")]
470    RelativeOrientation,
471}
472
473
474#[derive(Debug, Clone, Serialize, Deserialize, Default)]
475#[serde(rename_all = "camelCase")]
476pub struct SensorMetadata {
477    #[serde(skip_serializing_if = "Option::is_none")]
478    available: Option<bool>,
479    #[serde(skip_serializing_if = "Option::is_none", rename = "minimumFrequency")]
480    minimum_frequency: Option<f64>,
481    #[serde(skip_serializing_if = "Option::is_none", rename = "maximumFrequency")]
482    maximum_frequency: Option<f64>,
483}
484
485impl SensorMetadata {
486    /// Creates a builder for this type.
487    pub fn builder() -> SensorMetadataBuilder {
488        SensorMetadataBuilder {
489            available: None,
490            minimum_frequency: None,
491            maximum_frequency: None,
492        }
493    }
494    pub fn available(&self) -> Option<bool> { self.available }
495    pub fn minimum_frequency(&self) -> Option<f64> { self.minimum_frequency }
496    pub fn maximum_frequency(&self) -> Option<f64> { self.maximum_frequency }
497}
498
499#[derive(Default)]
500pub struct SensorMetadataBuilder {
501    available: Option<bool>,
502    minimum_frequency: Option<f64>,
503    maximum_frequency: Option<f64>,
504}
505
506impl SensorMetadataBuilder {
507    pub fn available(mut self, available: bool) -> Self { self.available = Some(available); self }
508    pub fn minimum_frequency(mut self, minimum_frequency: f64) -> Self { self.minimum_frequency = Some(minimum_frequency); self }
509    pub fn maximum_frequency(mut self, maximum_frequency: f64) -> Self { self.maximum_frequency = Some(maximum_frequency); self }
510    pub fn build(self) -> SensorMetadata {
511        SensorMetadata {
512            available: self.available,
513            minimum_frequency: self.minimum_frequency,
514            maximum_frequency: self.maximum_frequency,
515        }
516    }
517}
518
519
520#[derive(Debug, Clone, Serialize, Deserialize, Default)]
521#[serde(rename_all = "camelCase")]
522pub struct SensorReadingSingle {
523    value: f64,
524}
525
526impl SensorReadingSingle {
527    /// Creates a builder for this type with the required parameters:
528    /// * `value`: 
529    pub fn builder(value: f64) -> SensorReadingSingleBuilder {
530        SensorReadingSingleBuilder {
531            value: value,
532        }
533    }
534    pub fn value(&self) -> f64 { self.value }
535}
536
537
538pub struct SensorReadingSingleBuilder {
539    value: f64,
540}
541
542impl SensorReadingSingleBuilder {
543    pub fn build(self) -> SensorReadingSingle {
544        SensorReadingSingle {
545            value: self.value,
546        }
547    }
548}
549
550
551#[derive(Debug, Clone, Serialize, Deserialize, Default)]
552#[serde(rename_all = "camelCase")]
553pub struct SensorReadingXYZ {
554    x: f64,
555    y: f64,
556    z: f64,
557}
558
559impl SensorReadingXYZ {
560    /// Creates a builder for this type with the required parameters:
561    /// * `x`: 
562    /// * `y`: 
563    /// * `z`: 
564    pub fn builder(x: f64, y: f64, z: f64) -> SensorReadingXYZBuilder {
565        SensorReadingXYZBuilder {
566            x: x,
567            y: y,
568            z: z,
569        }
570    }
571    pub fn x(&self) -> f64 { self.x }
572    pub fn y(&self) -> f64 { self.y }
573    pub fn z(&self) -> f64 { self.z }
574}
575
576
577pub struct SensorReadingXYZBuilder {
578    x: f64,
579    y: f64,
580    z: f64,
581}
582
583impl SensorReadingXYZBuilder {
584    pub fn build(self) -> SensorReadingXYZ {
585        SensorReadingXYZ {
586            x: self.x,
587            y: self.y,
588            z: self.z,
589        }
590    }
591}
592
593
594#[derive(Debug, Clone, Serialize, Deserialize, Default)]
595#[serde(rename_all = "camelCase")]
596pub struct SensorReadingQuaternion {
597    x: f64,
598    y: f64,
599    z: f64,
600    w: f64,
601}
602
603impl SensorReadingQuaternion {
604    /// Creates a builder for this type with the required parameters:
605    /// * `x`: 
606    /// * `y`: 
607    /// * `z`: 
608    /// * `w`: 
609    pub fn builder(x: f64, y: f64, z: f64, w: f64) -> SensorReadingQuaternionBuilder {
610        SensorReadingQuaternionBuilder {
611            x: x,
612            y: y,
613            z: z,
614            w: w,
615        }
616    }
617    pub fn x(&self) -> f64 { self.x }
618    pub fn y(&self) -> f64 { self.y }
619    pub fn z(&self) -> f64 { self.z }
620    pub fn w(&self) -> f64 { self.w }
621}
622
623
624pub struct SensorReadingQuaternionBuilder {
625    x: f64,
626    y: f64,
627    z: f64,
628    w: f64,
629}
630
631impl SensorReadingQuaternionBuilder {
632    pub fn build(self) -> SensorReadingQuaternion {
633        SensorReadingQuaternion {
634            x: self.x,
635            y: self.y,
636            z: self.z,
637            w: self.w,
638        }
639    }
640}
641
642
643#[derive(Debug, Clone, Serialize, Deserialize, Default)]
644#[serde(rename_all = "camelCase")]
645pub struct SensorReading {
646    #[serde(skip_serializing_if = "Option::is_none")]
647    single: Option<SensorReadingSingle>,
648    #[serde(skip_serializing_if = "Option::is_none")]
649    xyz: Option<SensorReadingXYZ>,
650    #[serde(skip_serializing_if = "Option::is_none")]
651    quaternion: Option<SensorReadingQuaternion>,
652}
653
654impl SensorReading {
655    /// Creates a builder for this type.
656    pub fn builder() -> SensorReadingBuilder {
657        SensorReadingBuilder {
658            single: None,
659            xyz: None,
660            quaternion: None,
661        }
662    }
663    pub fn single(&self) -> Option<&SensorReadingSingle> { self.single.as_ref() }
664    pub fn xyz(&self) -> Option<&SensorReadingXYZ> { self.xyz.as_ref() }
665    pub fn quaternion(&self) -> Option<&SensorReadingQuaternion> { self.quaternion.as_ref() }
666}
667
668#[derive(Default)]
669pub struct SensorReadingBuilder {
670    single: Option<SensorReadingSingle>,
671    xyz: Option<SensorReadingXYZ>,
672    quaternion: Option<SensorReadingQuaternion>,
673}
674
675impl SensorReadingBuilder {
676    pub fn single(mut self, single: SensorReadingSingle) -> Self { self.single = Some(single); self }
677    pub fn xyz(mut self, xyz: SensorReadingXYZ) -> Self { self.xyz = Some(xyz); self }
678    pub fn quaternion(mut self, quaternion: SensorReadingQuaternion) -> Self { self.quaternion = Some(quaternion); self }
679    pub fn build(self) -> SensorReading {
680        SensorReading {
681            single: self.single,
682            xyz: self.xyz,
683            quaternion: self.quaternion,
684        }
685    }
686}
687
688
689#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
690pub enum PressureSource {
691    #[default]
692    #[serde(rename = "cpu")]
693    Cpu,
694}
695
696
697#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
698pub enum PressureState {
699    #[default]
700    #[serde(rename = "nominal")]
701    Nominal,
702    #[serde(rename = "fair")]
703    Fair,
704    #[serde(rename = "serious")]
705    Serious,
706    #[serde(rename = "critical")]
707    Critical,
708}
709
710
711#[derive(Debug, Clone, Serialize, Deserialize, Default)]
712#[serde(rename_all = "camelCase")]
713pub struct PressureMetadata {
714    #[serde(skip_serializing_if = "Option::is_none")]
715    available: Option<bool>,
716}
717
718impl PressureMetadata {
719    /// Creates a builder for this type.
720    pub fn builder() -> PressureMetadataBuilder {
721        PressureMetadataBuilder {
722            available: None,
723        }
724    }
725    pub fn available(&self) -> Option<bool> { self.available }
726}
727
728#[derive(Default)]
729pub struct PressureMetadataBuilder {
730    available: Option<bool>,
731}
732
733impl PressureMetadataBuilder {
734    pub fn available(mut self, available: bool) -> Self { self.available = Some(available); self }
735    pub fn build(self) -> PressureMetadata {
736        PressureMetadata {
737            available: self.available,
738        }
739    }
740}
741
742
743#[derive(Debug, Clone, Serialize, Deserialize, Default)]
744#[serde(rename_all = "camelCase")]
745pub struct WorkAreaInsets {
746    /// Work area top inset in pixels. Default is 0;
747    #[serde(skip_serializing_if = "Option::is_none")]
748    top: Option<i64>,
749    /// Work area left inset in pixels. Default is 0;
750    #[serde(skip_serializing_if = "Option::is_none")]
751    left: Option<i64>,
752    /// Work area bottom inset in pixels. Default is 0;
753    #[serde(skip_serializing_if = "Option::is_none")]
754    bottom: Option<i64>,
755    /// Work area right inset in pixels. Default is 0;
756    #[serde(skip_serializing_if = "Option::is_none")]
757    right: Option<i64>,
758}
759
760impl WorkAreaInsets {
761    /// Creates a builder for this type.
762    pub fn builder() -> WorkAreaInsetsBuilder {
763        WorkAreaInsetsBuilder {
764            top: None,
765            left: None,
766            bottom: None,
767            right: None,
768        }
769    }
770    /// Work area top inset in pixels. Default is 0;
771    pub fn top(&self) -> Option<i64> { self.top }
772    /// Work area left inset in pixels. Default is 0;
773    pub fn left(&self) -> Option<i64> { self.left }
774    /// Work area bottom inset in pixels. Default is 0;
775    pub fn bottom(&self) -> Option<i64> { self.bottom }
776    /// Work area right inset in pixels. Default is 0;
777    pub fn right(&self) -> Option<i64> { self.right }
778}
779
780#[derive(Default)]
781pub struct WorkAreaInsetsBuilder {
782    top: Option<i64>,
783    left: Option<i64>,
784    bottom: Option<i64>,
785    right: Option<i64>,
786}
787
788impl WorkAreaInsetsBuilder {
789    /// Work area top inset in pixels. Default is 0;
790    pub fn top(mut self, top: i64) -> Self { self.top = Some(top); self }
791    /// Work area left inset in pixels. Default is 0;
792    pub fn left(mut self, left: i64) -> Self { self.left = Some(left); self }
793    /// Work area bottom inset in pixels. Default is 0;
794    pub fn bottom(mut self, bottom: i64) -> Self { self.bottom = Some(bottom); self }
795    /// Work area right inset in pixels. Default is 0;
796    pub fn right(mut self, right: i64) -> Self { self.right = Some(right); self }
797    pub fn build(self) -> WorkAreaInsets {
798        WorkAreaInsets {
799            top: self.top,
800            left: self.left,
801            bottom: self.bottom,
802            right: self.right,
803        }
804    }
805}
806
807
808pub type ScreenId<'a> = Cow<'a, str>;
809
810/// Screen information similar to the one returned by window.getScreenDetails() method,
811/// see <https://w3c.github.io/window-management/#screendetailed>.
812
813#[derive(Debug, Clone, Serialize, Deserialize, Default)]
814#[serde(rename_all = "camelCase")]
815pub struct ScreenInfo<'a> {
816    /// Offset of the left edge of the screen.
817    left: i64,
818    /// Offset of the top edge of the screen.
819    top: i64,
820    /// Width of the screen.
821    width: u64,
822    /// Height of the screen.
823    height: i64,
824    /// Offset of the left edge of the available screen area.
825    #[serde(rename = "availLeft")]
826    avail_left: i64,
827    /// Offset of the top edge of the available screen area.
828    #[serde(rename = "availTop")]
829    avail_top: i64,
830    /// Width of the available screen area.
831    #[serde(rename = "availWidth")]
832    avail_width: u64,
833    /// Height of the available screen area.
834    #[serde(rename = "availHeight")]
835    avail_height: i64,
836    /// Specifies the screen's device pixel ratio.
837    #[serde(rename = "devicePixelRatio")]
838    device_pixel_ratio: f64,
839    /// Specifies the screen's orientation.
840    orientation: ScreenOrientation<'a>,
841    /// Specifies the screen's color depth in bits.
842    #[serde(rename = "colorDepth")]
843    color_depth: i64,
844    /// Indicates whether the device has multiple screens.
845    #[serde(rename = "isExtended")]
846    is_extended: bool,
847    /// Indicates whether the screen is internal to the device or external, attached to the device.
848    #[serde(rename = "isInternal")]
849    is_internal: bool,
850    /// Indicates whether the screen is set as the the operating system primary screen.
851    #[serde(rename = "isPrimary")]
852    is_primary: bool,
853    /// Specifies the descriptive label for the screen.
854    label: Cow<'a, str>,
855    /// Specifies the unique identifier of the screen.
856    id: ScreenId<'a>,
857}
858
859impl<'a> ScreenInfo<'a> {
860    /// Creates a builder for this type with the required parameters:
861    /// * `left`: Offset of the left edge of the screen.
862    /// * `top`: Offset of the top edge of the screen.
863    /// * `width`: Width of the screen.
864    /// * `height`: Height of the screen.
865    /// * `avail_left`: Offset of the left edge of the available screen area.
866    /// * `avail_top`: Offset of the top edge of the available screen area.
867    /// * `avail_width`: Width of the available screen area.
868    /// * `avail_height`: Height of the available screen area.
869    /// * `device_pixel_ratio`: Specifies the screen's device pixel ratio.
870    /// * `orientation`: Specifies the screen's orientation.
871    /// * `color_depth`: Specifies the screen's color depth in bits.
872    /// * `is_extended`: Indicates whether the device has multiple screens.
873    /// * `is_internal`: Indicates whether the screen is internal to the device or external, attached to the device.
874    /// * `is_primary`: Indicates whether the screen is set as the the operating system primary screen.
875    /// * `label`: Specifies the descriptive label for the screen.
876    /// * `id`: Specifies the unique identifier of the screen.
877    pub fn builder(left: i64, top: i64, width: u64, height: i64, avail_left: i64, avail_top: i64, avail_width: u64, avail_height: i64, device_pixel_ratio: f64, orientation: ScreenOrientation<'a>, color_depth: i64, is_extended: bool, is_internal: bool, is_primary: bool, label: impl Into<Cow<'a, str>>, id: impl Into<ScreenId<'a>>) -> ScreenInfoBuilder<'a> {
878        ScreenInfoBuilder {
879            left: left,
880            top: top,
881            width: width,
882            height: height,
883            avail_left: avail_left,
884            avail_top: avail_top,
885            avail_width: avail_width,
886            avail_height: avail_height,
887            device_pixel_ratio: device_pixel_ratio,
888            orientation: orientation,
889            color_depth: color_depth,
890            is_extended: is_extended,
891            is_internal: is_internal,
892            is_primary: is_primary,
893            label: label.into(),
894            id: id.into(),
895        }
896    }
897    /// Offset of the left edge of the screen.
898    pub fn left(&self) -> i64 { self.left }
899    /// Offset of the top edge of the screen.
900    pub fn top(&self) -> i64 { self.top }
901    /// Width of the screen.
902    pub fn width(&self) -> u64 { self.width }
903    /// Height of the screen.
904    pub fn height(&self) -> i64 { self.height }
905    /// Offset of the left edge of the available screen area.
906    pub fn avail_left(&self) -> i64 { self.avail_left }
907    /// Offset of the top edge of the available screen area.
908    pub fn avail_top(&self) -> i64 { self.avail_top }
909    /// Width of the available screen area.
910    pub fn avail_width(&self) -> u64 { self.avail_width }
911    /// Height of the available screen area.
912    pub fn avail_height(&self) -> i64 { self.avail_height }
913    /// Specifies the screen's device pixel ratio.
914    pub fn device_pixel_ratio(&self) -> f64 { self.device_pixel_ratio }
915    /// Specifies the screen's orientation.
916    pub fn orientation(&self) -> &ScreenOrientation<'a> { &self.orientation }
917    /// Specifies the screen's color depth in bits.
918    pub fn color_depth(&self) -> i64 { self.color_depth }
919    /// Indicates whether the device has multiple screens.
920    pub fn is_extended(&self) -> bool { self.is_extended }
921    /// Indicates whether the screen is internal to the device or external, attached to the device.
922    pub fn is_internal(&self) -> bool { self.is_internal }
923    /// Indicates whether the screen is set as the the operating system primary screen.
924    pub fn is_primary(&self) -> bool { self.is_primary }
925    /// Specifies the descriptive label for the screen.
926    pub fn label(&self) -> &str { self.label.as_ref() }
927    /// Specifies the unique identifier of the screen.
928    pub fn id(&self) -> &ScreenId<'a> { &self.id }
929}
930
931
932pub struct ScreenInfoBuilder<'a> {
933    left: i64,
934    top: i64,
935    width: u64,
936    height: i64,
937    avail_left: i64,
938    avail_top: i64,
939    avail_width: u64,
940    avail_height: i64,
941    device_pixel_ratio: f64,
942    orientation: ScreenOrientation<'a>,
943    color_depth: i64,
944    is_extended: bool,
945    is_internal: bool,
946    is_primary: bool,
947    label: Cow<'a, str>,
948    id: ScreenId<'a>,
949}
950
951impl<'a> ScreenInfoBuilder<'a> {
952    pub fn build(self) -> ScreenInfo<'a> {
953        ScreenInfo {
954            left: self.left,
955            top: self.top,
956            width: self.width,
957            height: self.height,
958            avail_left: self.avail_left,
959            avail_top: self.avail_top,
960            avail_width: self.avail_width,
961            avail_height: self.avail_height,
962            device_pixel_ratio: self.device_pixel_ratio,
963            orientation: self.orientation,
964            color_depth: self.color_depth,
965            is_extended: self.is_extended,
966            is_internal: self.is_internal,
967            is_primary: self.is_primary,
968            label: self.label,
969            id: self.id,
970        }
971    }
972}
973
974/// Enum of image types that can be disabled.
975
976#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
977pub enum DisabledImageType {
978    #[default]
979    #[serde(rename = "avif")]
980    Avif,
981    #[serde(rename = "jxl")]
982    Jxl,
983    #[serde(rename = "webp")]
984    Webp,
985}
986
987/// Tells whether emulation is supported.
988
989#[derive(Debug, Clone, Serialize, Deserialize, Default)]
990#[serde(rename_all = "camelCase")]
991pub struct CanEmulateReturns {
992    /// True if emulation is supported.
993    result: bool,
994}
995
996impl CanEmulateReturns {
997    /// Creates a builder for this type with the required parameters:
998    /// * `result`: True if emulation is supported.
999    pub fn builder(result: bool) -> CanEmulateReturnsBuilder {
1000        CanEmulateReturnsBuilder {
1001            result: result,
1002        }
1003    }
1004    /// True if emulation is supported.
1005    pub fn result(&self) -> bool { self.result }
1006}
1007
1008
1009pub struct CanEmulateReturnsBuilder {
1010    result: bool,
1011}
1012
1013impl CanEmulateReturnsBuilder {
1014    pub fn build(self) -> CanEmulateReturns {
1015        CanEmulateReturns {
1016            result: self.result,
1017        }
1018    }
1019}
1020
1021#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1022pub struct CanEmulateParams {}
1023
1024impl CanEmulateParams { pub const METHOD: &'static str = "Emulation.canEmulate"; }
1025
1026impl<'a> crate::CdpCommand<'a> for CanEmulateParams {
1027    const METHOD: &'static str = "Emulation.canEmulate";
1028    type Response = CanEmulateReturns;
1029}
1030
1031#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1032pub struct ClearDeviceMetricsOverrideParams {}
1033
1034impl ClearDeviceMetricsOverrideParams { pub const METHOD: &'static str = "Emulation.clearDeviceMetricsOverride"; }
1035
1036impl<'a> crate::CdpCommand<'a> for ClearDeviceMetricsOverrideParams {
1037    const METHOD: &'static str = "Emulation.clearDeviceMetricsOverride";
1038    type Response = crate::EmptyReturns;
1039}
1040
1041#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1042pub struct ClearGeolocationOverrideParams {}
1043
1044impl ClearGeolocationOverrideParams { pub const METHOD: &'static str = "Emulation.clearGeolocationOverride"; }
1045
1046impl<'a> crate::CdpCommand<'a> for ClearGeolocationOverrideParams {
1047    const METHOD: &'static str = "Emulation.clearGeolocationOverride";
1048    type Response = crate::EmptyReturns;
1049}
1050
1051#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1052pub struct ResetPageScaleFactorParams {}
1053
1054impl ResetPageScaleFactorParams { pub const METHOD: &'static str = "Emulation.resetPageScaleFactor"; }
1055
1056impl<'a> crate::CdpCommand<'a> for ResetPageScaleFactorParams {
1057    const METHOD: &'static str = "Emulation.resetPageScaleFactor";
1058    type Response = crate::EmptyReturns;
1059}
1060
1061/// Enables or disables simulating a focused and active page.
1062
1063#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1064#[serde(rename_all = "camelCase")]
1065pub struct SetFocusEmulationEnabledParams {
1066    /// Whether to enable to disable focus emulation.
1067    enabled: bool,
1068}
1069
1070impl SetFocusEmulationEnabledParams {
1071    /// Creates a builder for this type with the required parameters:
1072    /// * `enabled`: Whether to enable to disable focus emulation.
1073    pub fn builder(enabled: bool) -> SetFocusEmulationEnabledParamsBuilder {
1074        SetFocusEmulationEnabledParamsBuilder {
1075            enabled: enabled,
1076        }
1077    }
1078    /// Whether to enable to disable focus emulation.
1079    pub fn enabled(&self) -> bool { self.enabled }
1080}
1081
1082
1083pub struct SetFocusEmulationEnabledParamsBuilder {
1084    enabled: bool,
1085}
1086
1087impl SetFocusEmulationEnabledParamsBuilder {
1088    pub fn build(self) -> SetFocusEmulationEnabledParams {
1089        SetFocusEmulationEnabledParams {
1090            enabled: self.enabled,
1091        }
1092    }
1093}
1094
1095impl SetFocusEmulationEnabledParams { pub const METHOD: &'static str = "Emulation.setFocusEmulationEnabled"; }
1096
1097impl<'a> crate::CdpCommand<'a> for SetFocusEmulationEnabledParams {
1098    const METHOD: &'static str = "Emulation.setFocusEmulationEnabled";
1099    type Response = crate::EmptyReturns;
1100}
1101
1102/// Automatically render all web contents using a dark theme.
1103
1104#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1105#[serde(rename_all = "camelCase")]
1106pub struct SetAutoDarkModeOverrideParams {
1107    /// Whether to enable or disable automatic dark mode.
1108    /// If not specified, any existing override will be cleared.
1109    #[serde(skip_serializing_if = "Option::is_none")]
1110    enabled: Option<bool>,
1111}
1112
1113impl SetAutoDarkModeOverrideParams {
1114    /// Creates a builder for this type.
1115    pub fn builder() -> SetAutoDarkModeOverrideParamsBuilder {
1116        SetAutoDarkModeOverrideParamsBuilder {
1117            enabled: None,
1118        }
1119    }
1120    /// Whether to enable or disable automatic dark mode.
1121    /// If not specified, any existing override will be cleared.
1122    pub fn enabled(&self) -> Option<bool> { self.enabled }
1123}
1124
1125#[derive(Default)]
1126pub struct SetAutoDarkModeOverrideParamsBuilder {
1127    enabled: Option<bool>,
1128}
1129
1130impl SetAutoDarkModeOverrideParamsBuilder {
1131    /// Whether to enable or disable automatic dark mode.
1132    /// If not specified, any existing override will be cleared.
1133    pub fn enabled(mut self, enabled: bool) -> Self { self.enabled = Some(enabled); self }
1134    pub fn build(self) -> SetAutoDarkModeOverrideParams {
1135        SetAutoDarkModeOverrideParams {
1136            enabled: self.enabled,
1137        }
1138    }
1139}
1140
1141impl SetAutoDarkModeOverrideParams { pub const METHOD: &'static str = "Emulation.setAutoDarkModeOverride"; }
1142
1143impl<'a> crate::CdpCommand<'a> for SetAutoDarkModeOverrideParams {
1144    const METHOD: &'static str = "Emulation.setAutoDarkModeOverride";
1145    type Response = crate::EmptyReturns;
1146}
1147
1148/// Enables CPU throttling to emulate slow CPUs.
1149
1150#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1151#[serde(rename_all = "camelCase")]
1152pub struct SetCPUThrottlingRateParams {
1153    /// Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
1154    rate: f64,
1155}
1156
1157impl SetCPUThrottlingRateParams {
1158    /// Creates a builder for this type with the required parameters:
1159    /// * `rate`: Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
1160    pub fn builder(rate: f64) -> SetCPUThrottlingRateParamsBuilder {
1161        SetCPUThrottlingRateParamsBuilder {
1162            rate: rate,
1163        }
1164    }
1165    /// Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
1166    pub fn rate(&self) -> f64 { self.rate }
1167}
1168
1169
1170pub struct SetCPUThrottlingRateParamsBuilder {
1171    rate: f64,
1172}
1173
1174impl SetCPUThrottlingRateParamsBuilder {
1175    pub fn build(self) -> SetCPUThrottlingRateParams {
1176        SetCPUThrottlingRateParams {
1177            rate: self.rate,
1178        }
1179    }
1180}
1181
1182impl SetCPUThrottlingRateParams { pub const METHOD: &'static str = "Emulation.setCPUThrottlingRate"; }
1183
1184impl<'a> crate::CdpCommand<'a> for SetCPUThrottlingRateParams {
1185    const METHOD: &'static str = "Emulation.setCPUThrottlingRate";
1186    type Response = crate::EmptyReturns;
1187}
1188
1189/// Sets or clears an override of the default background color of the frame. This override is used
1190/// if the content does not specify one.
1191
1192#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1193#[serde(rename_all = "camelCase")]
1194pub struct SetDefaultBackgroundColorOverrideParams {
1195    /// RGBA of the default background color. If not specified, any existing override will be
1196    /// cleared.
1197    #[serde(skip_serializing_if = "Option::is_none")]
1198    color: Option<crate::dom::RGBA>,
1199}
1200
1201impl SetDefaultBackgroundColorOverrideParams {
1202    /// Creates a builder for this type.
1203    pub fn builder() -> SetDefaultBackgroundColorOverrideParamsBuilder {
1204        SetDefaultBackgroundColorOverrideParamsBuilder {
1205            color: None,
1206        }
1207    }
1208    /// RGBA of the default background color. If not specified, any existing override will be
1209    /// cleared.
1210    pub fn color(&self) -> Option<&crate::dom::RGBA> { self.color.as_ref() }
1211}
1212
1213#[derive(Default)]
1214pub struct SetDefaultBackgroundColorOverrideParamsBuilder {
1215    color: Option<crate::dom::RGBA>,
1216}
1217
1218impl SetDefaultBackgroundColorOverrideParamsBuilder {
1219    /// RGBA of the default background color. If not specified, any existing override will be
1220    /// cleared.
1221    pub fn color(mut self, color: crate::dom::RGBA) -> Self { self.color = Some(color); self }
1222    pub fn build(self) -> SetDefaultBackgroundColorOverrideParams {
1223        SetDefaultBackgroundColorOverrideParams {
1224            color: self.color,
1225        }
1226    }
1227}
1228
1229impl SetDefaultBackgroundColorOverrideParams { pub const METHOD: &'static str = "Emulation.setDefaultBackgroundColorOverride"; }
1230
1231impl<'a> crate::CdpCommand<'a> for SetDefaultBackgroundColorOverrideParams {
1232    const METHOD: &'static str = "Emulation.setDefaultBackgroundColorOverride";
1233    type Response = crate::EmptyReturns;
1234}
1235
1236/// Overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the
1237/// respective variables to be undefined, even if previously overridden.
1238
1239#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1240#[serde(rename_all = "camelCase")]
1241pub struct SetSafeAreaInsetsOverrideParams {
1242    insets: SafeAreaInsets,
1243}
1244
1245impl SetSafeAreaInsetsOverrideParams {
1246    /// Creates a builder for this type with the required parameters:
1247    /// * `insets`: 
1248    pub fn builder(insets: SafeAreaInsets) -> SetSafeAreaInsetsOverrideParamsBuilder {
1249        SetSafeAreaInsetsOverrideParamsBuilder {
1250            insets: insets,
1251        }
1252    }
1253    pub fn insets(&self) -> &SafeAreaInsets { &self.insets }
1254}
1255
1256
1257pub struct SetSafeAreaInsetsOverrideParamsBuilder {
1258    insets: SafeAreaInsets,
1259}
1260
1261impl SetSafeAreaInsetsOverrideParamsBuilder {
1262    pub fn build(self) -> SetSafeAreaInsetsOverrideParams {
1263        SetSafeAreaInsetsOverrideParams {
1264            insets: self.insets,
1265        }
1266    }
1267}
1268
1269impl SetSafeAreaInsetsOverrideParams { pub const METHOD: &'static str = "Emulation.setSafeAreaInsetsOverride"; }
1270
1271impl<'a> crate::CdpCommand<'a> for SetSafeAreaInsetsOverrideParams {
1272    const METHOD: &'static str = "Emulation.setSafeAreaInsetsOverride";
1273    type Response = crate::EmptyReturns;
1274}
1275
1276/// Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
1277/// window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
1278/// query results).
1279
1280#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1281#[serde(rename_all = "camelCase")]
1282pub struct SetDeviceMetricsOverrideParams<'a> {
1283    /// Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
1284    width: u64,
1285    /// Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
1286    height: i64,
1287    /// Overriding device scale factor value. 0 disables the override.
1288    #[serde(rename = "deviceScaleFactor")]
1289    device_scale_factor: f64,
1290    /// Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text
1291    /// autosizing and more.
1292    mobile: bool,
1293    /// Scale to apply to resulting view image.
1294    #[serde(skip_serializing_if = "Option::is_none")]
1295    scale: Option<f64>,
1296    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
1297    #[serde(skip_serializing_if = "Option::is_none", rename = "screenWidth")]
1298    screen_width: Option<u64>,
1299    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
1300    #[serde(skip_serializing_if = "Option::is_none", rename = "screenHeight")]
1301    screen_height: Option<i64>,
1302    /// Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
1303    #[serde(skip_serializing_if = "Option::is_none", rename = "positionX")]
1304    position_x: Option<i64>,
1305    /// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
1306    #[serde(skip_serializing_if = "Option::is_none", rename = "positionY")]
1307    position_y: Option<i64>,
1308    /// Do not set visible view size, rely upon explicit setVisibleSize call.
1309    #[serde(skip_serializing_if = "Option::is_none", rename = "dontSetVisibleSize")]
1310    dont_set_visible_size: Option<bool>,
1311    /// Screen orientation override.
1312    #[serde(skip_serializing_if = "Option::is_none", rename = "screenOrientation")]
1313    screen_orientation: Option<ScreenOrientation<'a>>,
1314    /// If set, the visible area of the page will be overridden to this viewport. This viewport
1315    /// change is not observed by the page, e.g. viewport-relative elements do not change positions.
1316    #[serde(skip_serializing_if = "Option::is_none")]
1317    viewport: Option<crate::page::Viewport>,
1318    /// If set, the display feature of a multi-segment screen. If not set, multi-segment support
1319    /// is turned-off.
1320    /// Deprecated, use Emulation.setDisplayFeaturesOverride.
1321    #[serde(skip_serializing_if = "Option::is_none", rename = "displayFeature")]
1322    display_feature: Option<DisplayFeature<'a>>,
1323    /// If set, the posture of a foldable device. If not set the posture is set
1324    /// to continuous.
1325    /// Deprecated, use Emulation.setDevicePostureOverride.
1326    #[serde(skip_serializing_if = "Option::is_none", rename = "devicePosture")]
1327    device_posture: Option<DevicePosture<'a>>,
1328    /// Scrollbar type. Default: 'default'.
1329    #[serde(skip_serializing_if = "Option::is_none", rename = "scrollbarType")]
1330    scrollbar_type: Option<Cow<'a, str>>,
1331    /// If set to true, enables screen orientation lock emulation, which
1332    /// intercepts screen.orientation.lock() calls from the page and reports
1333    /// orientation changes via screenOrientationLockChanged events. This is
1334    /// useful for emulating mobile device orientation lock behavior in
1335    /// responsive design mode.
1336    #[serde(skip_serializing_if = "Option::is_none", rename = "screenOrientationLockEmulation")]
1337    screen_orientation_lock_emulation: Option<bool>,
1338}
1339
1340impl<'a> SetDeviceMetricsOverrideParams<'a> {
1341    /// Creates a builder for this type with the required parameters:
1342    /// * `width`: Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
1343    /// * `height`: Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
1344    /// * `device_scale_factor`: Overriding device scale factor value. 0 disables the override.
1345    /// * `mobile`: Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
1346    pub fn builder(width: u64, height: i64, device_scale_factor: f64, mobile: bool) -> SetDeviceMetricsOverrideParamsBuilder<'a> {
1347        SetDeviceMetricsOverrideParamsBuilder {
1348            width: width,
1349            height: height,
1350            device_scale_factor: device_scale_factor,
1351            mobile: mobile,
1352            scale: None,
1353            screen_width: None,
1354            screen_height: None,
1355            position_x: None,
1356            position_y: None,
1357            dont_set_visible_size: None,
1358            screen_orientation: None,
1359            viewport: None,
1360            display_feature: None,
1361            device_posture: None,
1362            scrollbar_type: None,
1363            screen_orientation_lock_emulation: None,
1364        }
1365    }
1366    /// Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
1367    pub fn width(&self) -> u64 { self.width }
1368    /// Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
1369    pub fn height(&self) -> i64 { self.height }
1370    /// Overriding device scale factor value. 0 disables the override.
1371    pub fn device_scale_factor(&self) -> f64 { self.device_scale_factor }
1372    /// Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text
1373    /// autosizing and more.
1374    pub fn mobile(&self) -> bool { self.mobile }
1375    /// Scale to apply to resulting view image.
1376    pub fn scale(&self) -> Option<f64> { self.scale }
1377    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
1378    pub fn screen_width(&self) -> Option<u64> { self.screen_width }
1379    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
1380    pub fn screen_height(&self) -> Option<i64> { self.screen_height }
1381    /// Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
1382    pub fn position_x(&self) -> Option<i64> { self.position_x }
1383    /// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
1384    pub fn position_y(&self) -> Option<i64> { self.position_y }
1385    /// Do not set visible view size, rely upon explicit setVisibleSize call.
1386    pub fn dont_set_visible_size(&self) -> Option<bool> { self.dont_set_visible_size }
1387    /// Screen orientation override.
1388    pub fn screen_orientation(&self) -> Option<&ScreenOrientation<'a>> { self.screen_orientation.as_ref() }
1389    /// If set, the visible area of the page will be overridden to this viewport. This viewport
1390    /// change is not observed by the page, e.g. viewport-relative elements do not change positions.
1391    pub fn viewport(&self) -> Option<&crate::page::Viewport> { self.viewport.as_ref() }
1392    /// If set, the display feature of a multi-segment screen. If not set, multi-segment support
1393    /// is turned-off.
1394    /// Deprecated, use Emulation.setDisplayFeaturesOverride.
1395    pub fn display_feature(&self) -> Option<&DisplayFeature<'a>> { self.display_feature.as_ref() }
1396    /// If set, the posture of a foldable device. If not set the posture is set
1397    /// to continuous.
1398    /// Deprecated, use Emulation.setDevicePostureOverride.
1399    pub fn device_posture(&self) -> Option<&DevicePosture<'a>> { self.device_posture.as_ref() }
1400    /// Scrollbar type. Default: 'default'.
1401    pub fn scrollbar_type(&self) -> Option<&str> { self.scrollbar_type.as_deref() }
1402    /// If set to true, enables screen orientation lock emulation, which
1403    /// intercepts screen.orientation.lock() calls from the page and reports
1404    /// orientation changes via screenOrientationLockChanged events. This is
1405    /// useful for emulating mobile device orientation lock behavior in
1406    /// responsive design mode.
1407    pub fn screen_orientation_lock_emulation(&self) -> Option<bool> { self.screen_orientation_lock_emulation }
1408}
1409
1410
1411pub struct SetDeviceMetricsOverrideParamsBuilder<'a> {
1412    width: u64,
1413    height: i64,
1414    device_scale_factor: f64,
1415    mobile: bool,
1416    scale: Option<f64>,
1417    screen_width: Option<u64>,
1418    screen_height: Option<i64>,
1419    position_x: Option<i64>,
1420    position_y: Option<i64>,
1421    dont_set_visible_size: Option<bool>,
1422    screen_orientation: Option<ScreenOrientation<'a>>,
1423    viewport: Option<crate::page::Viewport>,
1424    display_feature: Option<DisplayFeature<'a>>,
1425    device_posture: Option<DevicePosture<'a>>,
1426    scrollbar_type: Option<Cow<'a, str>>,
1427    screen_orientation_lock_emulation: Option<bool>,
1428}
1429
1430impl<'a> SetDeviceMetricsOverrideParamsBuilder<'a> {
1431    /// Scale to apply to resulting view image.
1432    pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
1433    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
1434    pub fn screen_width(mut self, screen_width: u64) -> Self { self.screen_width = Some(screen_width); self }
1435    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
1436    pub fn screen_height(mut self, screen_height: i64) -> Self { self.screen_height = Some(screen_height); self }
1437    /// Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
1438    pub fn position_x(mut self, position_x: i64) -> Self { self.position_x = Some(position_x); self }
1439    /// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
1440    pub fn position_y(mut self, position_y: i64) -> Self { self.position_y = Some(position_y); self }
1441    /// Do not set visible view size, rely upon explicit setVisibleSize call.
1442    pub fn dont_set_visible_size(mut self, dont_set_visible_size: bool) -> Self { self.dont_set_visible_size = Some(dont_set_visible_size); self }
1443    /// Screen orientation override.
1444    pub fn screen_orientation(mut self, screen_orientation: ScreenOrientation<'a>) -> Self { self.screen_orientation = Some(screen_orientation); self }
1445    /// If set, the visible area of the page will be overridden to this viewport. This viewport
1446    /// change is not observed by the page, e.g. viewport-relative elements do not change positions.
1447    pub fn viewport(mut self, viewport: crate::page::Viewport) -> Self { self.viewport = Some(viewport); self }
1448    /// If set, the display feature of a multi-segment screen. If not set, multi-segment support
1449    /// is turned-off.
1450    /// Deprecated, use Emulation.setDisplayFeaturesOverride.
1451    pub fn display_feature(mut self, display_feature: DisplayFeature<'a>) -> Self { self.display_feature = Some(display_feature); self }
1452    /// If set, the posture of a foldable device. If not set the posture is set
1453    /// to continuous.
1454    /// Deprecated, use Emulation.setDevicePostureOverride.
1455    pub fn device_posture(mut self, device_posture: DevicePosture<'a>) -> Self { self.device_posture = Some(device_posture); self }
1456    /// Scrollbar type. Default: 'default'.
1457    pub fn scrollbar_type(mut self, scrollbar_type: impl Into<Cow<'a, str>>) -> Self { self.scrollbar_type = Some(scrollbar_type.into()); self }
1458    /// If set to true, enables screen orientation lock emulation, which
1459    /// intercepts screen.orientation.lock() calls from the page and reports
1460    /// orientation changes via screenOrientationLockChanged events. This is
1461    /// useful for emulating mobile device orientation lock behavior in
1462    /// responsive design mode.
1463    pub fn screen_orientation_lock_emulation(mut self, screen_orientation_lock_emulation: bool) -> Self { self.screen_orientation_lock_emulation = Some(screen_orientation_lock_emulation); self }
1464    pub fn build(self) -> SetDeviceMetricsOverrideParams<'a> {
1465        SetDeviceMetricsOverrideParams {
1466            width: self.width,
1467            height: self.height,
1468            device_scale_factor: self.device_scale_factor,
1469            mobile: self.mobile,
1470            scale: self.scale,
1471            screen_width: self.screen_width,
1472            screen_height: self.screen_height,
1473            position_x: self.position_x,
1474            position_y: self.position_y,
1475            dont_set_visible_size: self.dont_set_visible_size,
1476            screen_orientation: self.screen_orientation,
1477            viewport: self.viewport,
1478            display_feature: self.display_feature,
1479            device_posture: self.device_posture,
1480            scrollbar_type: self.scrollbar_type,
1481            screen_orientation_lock_emulation: self.screen_orientation_lock_emulation,
1482        }
1483    }
1484}
1485
1486impl<'a> SetDeviceMetricsOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setDeviceMetricsOverride"; }
1487
1488impl<'a> crate::CdpCommand<'a> for SetDeviceMetricsOverrideParams<'a> {
1489    const METHOD: &'static str = "Emulation.setDeviceMetricsOverride";
1490    type Response = crate::EmptyReturns;
1491}
1492
1493/// Start reporting the given posture value to the Device Posture API.
1494/// This override can also be set in setDeviceMetricsOverride().
1495
1496#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1497#[serde(rename_all = "camelCase")]
1498pub struct SetDevicePostureOverrideParams<'a> {
1499    posture: DevicePosture<'a>,
1500}
1501
1502impl<'a> SetDevicePostureOverrideParams<'a> {
1503    /// Creates a builder for this type with the required parameters:
1504    /// * `posture`: 
1505    pub fn builder(posture: DevicePosture<'a>) -> SetDevicePostureOverrideParamsBuilder<'a> {
1506        SetDevicePostureOverrideParamsBuilder {
1507            posture: posture,
1508        }
1509    }
1510    pub fn posture(&self) -> &DevicePosture<'a> { &self.posture }
1511}
1512
1513
1514pub struct SetDevicePostureOverrideParamsBuilder<'a> {
1515    posture: DevicePosture<'a>,
1516}
1517
1518impl<'a> SetDevicePostureOverrideParamsBuilder<'a> {
1519    pub fn build(self) -> SetDevicePostureOverrideParams<'a> {
1520        SetDevicePostureOverrideParams {
1521            posture: self.posture,
1522        }
1523    }
1524}
1525
1526impl<'a> SetDevicePostureOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setDevicePostureOverride"; }
1527
1528impl<'a> crate::CdpCommand<'a> for SetDevicePostureOverrideParams<'a> {
1529    const METHOD: &'static str = "Emulation.setDevicePostureOverride";
1530    type Response = crate::EmptyReturns;
1531}
1532
1533#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1534pub struct ClearDevicePostureOverrideParams {}
1535
1536impl ClearDevicePostureOverrideParams { pub const METHOD: &'static str = "Emulation.clearDevicePostureOverride"; }
1537
1538impl<'a> crate::CdpCommand<'a> for ClearDevicePostureOverrideParams {
1539    const METHOD: &'static str = "Emulation.clearDevicePostureOverride";
1540    type Response = crate::EmptyReturns;
1541}
1542
1543/// Start using the given display features to pupulate the Viewport Segments API.
1544/// This override can also be set in setDeviceMetricsOverride().
1545
1546#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1547#[serde(rename_all = "camelCase")]
1548pub struct SetDisplayFeaturesOverrideParams<'a> {
1549    features: Vec<DisplayFeature<'a>>,
1550}
1551
1552impl<'a> SetDisplayFeaturesOverrideParams<'a> {
1553    /// Creates a builder for this type with the required parameters:
1554    /// * `features`: 
1555    pub fn builder(features: Vec<DisplayFeature<'a>>) -> SetDisplayFeaturesOverrideParamsBuilder<'a> {
1556        SetDisplayFeaturesOverrideParamsBuilder {
1557            features: features,
1558        }
1559    }
1560    pub fn features(&self) -> &[DisplayFeature<'a>] { &self.features }
1561}
1562
1563
1564pub struct SetDisplayFeaturesOverrideParamsBuilder<'a> {
1565    features: Vec<DisplayFeature<'a>>,
1566}
1567
1568impl<'a> SetDisplayFeaturesOverrideParamsBuilder<'a> {
1569    pub fn build(self) -> SetDisplayFeaturesOverrideParams<'a> {
1570        SetDisplayFeaturesOverrideParams {
1571            features: self.features,
1572        }
1573    }
1574}
1575
1576impl<'a> SetDisplayFeaturesOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setDisplayFeaturesOverride"; }
1577
1578impl<'a> crate::CdpCommand<'a> for SetDisplayFeaturesOverrideParams<'a> {
1579    const METHOD: &'static str = "Emulation.setDisplayFeaturesOverride";
1580    type Response = crate::EmptyReturns;
1581}
1582
1583#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1584pub struct ClearDisplayFeaturesOverrideParams {}
1585
1586impl ClearDisplayFeaturesOverrideParams { pub const METHOD: &'static str = "Emulation.clearDisplayFeaturesOverride"; }
1587
1588impl<'a> crate::CdpCommand<'a> for ClearDisplayFeaturesOverrideParams {
1589    const METHOD: &'static str = "Emulation.clearDisplayFeaturesOverride";
1590    type Response = crate::EmptyReturns;
1591}
1592
1593
1594#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1595#[serde(rename_all = "camelCase")]
1596pub struct SetScrollbarsHiddenParams {
1597    /// Whether scrollbars should be always hidden.
1598    hidden: bool,
1599}
1600
1601impl SetScrollbarsHiddenParams {
1602    /// Creates a builder for this type with the required parameters:
1603    /// * `hidden`: Whether scrollbars should be always hidden.
1604    pub fn builder(hidden: bool) -> SetScrollbarsHiddenParamsBuilder {
1605        SetScrollbarsHiddenParamsBuilder {
1606            hidden: hidden,
1607        }
1608    }
1609    /// Whether scrollbars should be always hidden.
1610    pub fn hidden(&self) -> bool { self.hidden }
1611}
1612
1613
1614pub struct SetScrollbarsHiddenParamsBuilder {
1615    hidden: bool,
1616}
1617
1618impl SetScrollbarsHiddenParamsBuilder {
1619    pub fn build(self) -> SetScrollbarsHiddenParams {
1620        SetScrollbarsHiddenParams {
1621            hidden: self.hidden,
1622        }
1623    }
1624}
1625
1626impl SetScrollbarsHiddenParams { pub const METHOD: &'static str = "Emulation.setScrollbarsHidden"; }
1627
1628impl<'a> crate::CdpCommand<'a> for SetScrollbarsHiddenParams {
1629    const METHOD: &'static str = "Emulation.setScrollbarsHidden";
1630    type Response = crate::EmptyReturns;
1631}
1632
1633
1634#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1635#[serde(rename_all = "camelCase")]
1636pub struct SetDocumentCookieDisabledParams {
1637    /// Whether document.coookie API should be disabled.
1638    disabled: bool,
1639}
1640
1641impl SetDocumentCookieDisabledParams {
1642    /// Creates a builder for this type with the required parameters:
1643    /// * `disabled`: Whether document.coookie API should be disabled.
1644    pub fn builder(disabled: bool) -> SetDocumentCookieDisabledParamsBuilder {
1645        SetDocumentCookieDisabledParamsBuilder {
1646            disabled: disabled,
1647        }
1648    }
1649    /// Whether document.coookie API should be disabled.
1650    pub fn disabled(&self) -> bool { self.disabled }
1651}
1652
1653
1654pub struct SetDocumentCookieDisabledParamsBuilder {
1655    disabled: bool,
1656}
1657
1658impl SetDocumentCookieDisabledParamsBuilder {
1659    pub fn build(self) -> SetDocumentCookieDisabledParams {
1660        SetDocumentCookieDisabledParams {
1661            disabled: self.disabled,
1662        }
1663    }
1664}
1665
1666impl SetDocumentCookieDisabledParams { pub const METHOD: &'static str = "Emulation.setDocumentCookieDisabled"; }
1667
1668impl<'a> crate::CdpCommand<'a> for SetDocumentCookieDisabledParams {
1669    const METHOD: &'static str = "Emulation.setDocumentCookieDisabled";
1670    type Response = crate::EmptyReturns;
1671}
1672
1673
1674#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1675#[serde(rename_all = "camelCase")]
1676pub struct SetEmitTouchEventsForMouseParams<'a> {
1677    /// Whether touch emulation based on mouse input should be enabled.
1678    enabled: bool,
1679    /// Touch/gesture events configuration. Default: current platform.
1680    #[serde(skip_serializing_if = "Option::is_none")]
1681    configuration: Option<Cow<'a, str>>,
1682}
1683
1684impl<'a> SetEmitTouchEventsForMouseParams<'a> {
1685    /// Creates a builder for this type with the required parameters:
1686    /// * `enabled`: Whether touch emulation based on mouse input should be enabled.
1687    pub fn builder(enabled: bool) -> SetEmitTouchEventsForMouseParamsBuilder<'a> {
1688        SetEmitTouchEventsForMouseParamsBuilder {
1689            enabled: enabled,
1690            configuration: None,
1691        }
1692    }
1693    /// Whether touch emulation based on mouse input should be enabled.
1694    pub fn enabled(&self) -> bool { self.enabled }
1695    /// Touch/gesture events configuration. Default: current platform.
1696    pub fn configuration(&self) -> Option<&str> { self.configuration.as_deref() }
1697}
1698
1699
1700pub struct SetEmitTouchEventsForMouseParamsBuilder<'a> {
1701    enabled: bool,
1702    configuration: Option<Cow<'a, str>>,
1703}
1704
1705impl<'a> SetEmitTouchEventsForMouseParamsBuilder<'a> {
1706    /// Touch/gesture events configuration. Default: current platform.
1707    pub fn configuration(mut self, configuration: impl Into<Cow<'a, str>>) -> Self { self.configuration = Some(configuration.into()); self }
1708    pub fn build(self) -> SetEmitTouchEventsForMouseParams<'a> {
1709        SetEmitTouchEventsForMouseParams {
1710            enabled: self.enabled,
1711            configuration: self.configuration,
1712        }
1713    }
1714}
1715
1716impl<'a> SetEmitTouchEventsForMouseParams<'a> { pub const METHOD: &'static str = "Emulation.setEmitTouchEventsForMouse"; }
1717
1718impl<'a> crate::CdpCommand<'a> for SetEmitTouchEventsForMouseParams<'a> {
1719    const METHOD: &'static str = "Emulation.setEmitTouchEventsForMouse";
1720    type Response = crate::EmptyReturns;
1721}
1722
1723/// Emulates the given media type or media feature for CSS media queries.
1724
1725#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1726#[serde(rename_all = "camelCase")]
1727pub struct SetEmulatedMediaParams<'a> {
1728    /// Media type to emulate. Empty string disables the override.
1729    #[serde(skip_serializing_if = "Option::is_none")]
1730    media: Option<Cow<'a, str>>,
1731    /// Media features to emulate.
1732    #[serde(skip_serializing_if = "Option::is_none")]
1733    features: Option<Vec<MediaFeature<'a>>>,
1734}
1735
1736impl<'a> SetEmulatedMediaParams<'a> {
1737    /// Creates a builder for this type.
1738    pub fn builder() -> SetEmulatedMediaParamsBuilder<'a> {
1739        SetEmulatedMediaParamsBuilder {
1740            media: None,
1741            features: None,
1742        }
1743    }
1744    /// Media type to emulate. Empty string disables the override.
1745    pub fn media(&self) -> Option<&str> { self.media.as_deref() }
1746    /// Media features to emulate.
1747    pub fn features(&self) -> Option<&[MediaFeature<'a>]> { self.features.as_deref() }
1748}
1749
1750#[derive(Default)]
1751pub struct SetEmulatedMediaParamsBuilder<'a> {
1752    media: Option<Cow<'a, str>>,
1753    features: Option<Vec<MediaFeature<'a>>>,
1754}
1755
1756impl<'a> SetEmulatedMediaParamsBuilder<'a> {
1757    /// Media type to emulate. Empty string disables the override.
1758    pub fn media(mut self, media: impl Into<Cow<'a, str>>) -> Self { self.media = Some(media.into()); self }
1759    /// Media features to emulate.
1760    pub fn features(mut self, features: Vec<MediaFeature<'a>>) -> Self { self.features = Some(features); self }
1761    pub fn build(self) -> SetEmulatedMediaParams<'a> {
1762        SetEmulatedMediaParams {
1763            media: self.media,
1764            features: self.features,
1765        }
1766    }
1767}
1768
1769impl<'a> SetEmulatedMediaParams<'a> { pub const METHOD: &'static str = "Emulation.setEmulatedMedia"; }
1770
1771impl<'a> crate::CdpCommand<'a> for SetEmulatedMediaParams<'a> {
1772    const METHOD: &'static str = "Emulation.setEmulatedMedia";
1773    type Response = crate::EmptyReturns;
1774}
1775
1776/// Emulates the given vision deficiency.
1777
1778#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1779#[serde(rename_all = "camelCase")]
1780pub struct SetEmulatedVisionDeficiencyParams<'a> {
1781    /// Vision deficiency to emulate. Order: best-effort emulations come first, followed by any
1782    /// physiologically accurate emulations for medically recognized color vision deficiencies.
1783    #[serde(rename = "type")]
1784    type_: Cow<'a, str>,
1785}
1786
1787impl<'a> SetEmulatedVisionDeficiencyParams<'a> {
1788    /// Creates a builder for this type with the required parameters:
1789    /// * `type_`: Vision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies.
1790    pub fn builder(type_: impl Into<Cow<'a, str>>) -> SetEmulatedVisionDeficiencyParamsBuilder<'a> {
1791        SetEmulatedVisionDeficiencyParamsBuilder {
1792            type_: type_.into(),
1793        }
1794    }
1795    /// Vision deficiency to emulate. Order: best-effort emulations come first, followed by any
1796    /// physiologically accurate emulations for medically recognized color vision deficiencies.
1797    pub fn type_(&self) -> &str { self.type_.as_ref() }
1798}
1799
1800
1801pub struct SetEmulatedVisionDeficiencyParamsBuilder<'a> {
1802    type_: Cow<'a, str>,
1803}
1804
1805impl<'a> SetEmulatedVisionDeficiencyParamsBuilder<'a> {
1806    pub fn build(self) -> SetEmulatedVisionDeficiencyParams<'a> {
1807        SetEmulatedVisionDeficiencyParams {
1808            type_: self.type_,
1809        }
1810    }
1811}
1812
1813impl<'a> SetEmulatedVisionDeficiencyParams<'a> { pub const METHOD: &'static str = "Emulation.setEmulatedVisionDeficiency"; }
1814
1815impl<'a> crate::CdpCommand<'a> for SetEmulatedVisionDeficiencyParams<'a> {
1816    const METHOD: &'static str = "Emulation.setEmulatedVisionDeficiency";
1817    type Response = crate::EmptyReturns;
1818}
1819
1820/// Emulates the given OS text scale.
1821
1822#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1823#[serde(rename_all = "camelCase")]
1824pub struct SetEmulatedOSTextScaleParams {
1825    #[serde(skip_serializing_if = "Option::is_none")]
1826    scale: Option<f64>,
1827}
1828
1829impl SetEmulatedOSTextScaleParams {
1830    /// Creates a builder for this type.
1831    pub fn builder() -> SetEmulatedOSTextScaleParamsBuilder {
1832        SetEmulatedOSTextScaleParamsBuilder {
1833            scale: None,
1834        }
1835    }
1836    pub fn scale(&self) -> Option<f64> { self.scale }
1837}
1838
1839#[derive(Default)]
1840pub struct SetEmulatedOSTextScaleParamsBuilder {
1841    scale: Option<f64>,
1842}
1843
1844impl SetEmulatedOSTextScaleParamsBuilder {
1845    pub fn scale(mut self, scale: f64) -> Self { self.scale = Some(scale); self }
1846    pub fn build(self) -> SetEmulatedOSTextScaleParams {
1847        SetEmulatedOSTextScaleParams {
1848            scale: self.scale,
1849        }
1850    }
1851}
1852
1853impl SetEmulatedOSTextScaleParams { pub const METHOD: &'static str = "Emulation.setEmulatedOSTextScale"; }
1854
1855impl<'a> crate::CdpCommand<'a> for SetEmulatedOSTextScaleParams {
1856    const METHOD: &'static str = "Emulation.setEmulatedOSTextScale";
1857    type Response = crate::EmptyReturns;
1858}
1859
1860/// Overrides the Geolocation Position or Error. Omitting latitude, longitude or
1861/// accuracy emulates position unavailable.
1862
1863#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1864#[serde(rename_all = "camelCase")]
1865pub struct SetGeolocationOverrideParams {
1866    /// Mock latitude
1867    #[serde(skip_serializing_if = "Option::is_none")]
1868    latitude: Option<f64>,
1869    /// Mock longitude
1870    #[serde(skip_serializing_if = "Option::is_none")]
1871    longitude: Option<f64>,
1872    /// Mock accuracy
1873    #[serde(skip_serializing_if = "Option::is_none")]
1874    accuracy: Option<f64>,
1875    /// Mock altitude
1876    #[serde(skip_serializing_if = "Option::is_none")]
1877    altitude: Option<f64>,
1878    /// Mock altitudeAccuracy
1879    #[serde(skip_serializing_if = "Option::is_none", rename = "altitudeAccuracy")]
1880    altitude_accuracy: Option<f64>,
1881    /// Mock heading
1882    #[serde(skip_serializing_if = "Option::is_none")]
1883    heading: Option<f64>,
1884    /// Mock speed
1885    #[serde(skip_serializing_if = "Option::is_none")]
1886    speed: Option<f64>,
1887}
1888
1889impl SetGeolocationOverrideParams {
1890    /// Creates a builder for this type.
1891    pub fn builder() -> SetGeolocationOverrideParamsBuilder {
1892        SetGeolocationOverrideParamsBuilder {
1893            latitude: None,
1894            longitude: None,
1895            accuracy: None,
1896            altitude: None,
1897            altitude_accuracy: None,
1898            heading: None,
1899            speed: None,
1900        }
1901    }
1902    /// Mock latitude
1903    pub fn latitude(&self) -> Option<f64> { self.latitude }
1904    /// Mock longitude
1905    pub fn longitude(&self) -> Option<f64> { self.longitude }
1906    /// Mock accuracy
1907    pub fn accuracy(&self) -> Option<f64> { self.accuracy }
1908    /// Mock altitude
1909    pub fn altitude(&self) -> Option<f64> { self.altitude }
1910    /// Mock altitudeAccuracy
1911    pub fn altitude_accuracy(&self) -> Option<f64> { self.altitude_accuracy }
1912    /// Mock heading
1913    pub fn heading(&self) -> Option<f64> { self.heading }
1914    /// Mock speed
1915    pub fn speed(&self) -> Option<f64> { self.speed }
1916}
1917
1918#[derive(Default)]
1919pub struct SetGeolocationOverrideParamsBuilder {
1920    latitude: Option<f64>,
1921    longitude: Option<f64>,
1922    accuracy: Option<f64>,
1923    altitude: Option<f64>,
1924    altitude_accuracy: Option<f64>,
1925    heading: Option<f64>,
1926    speed: Option<f64>,
1927}
1928
1929impl SetGeolocationOverrideParamsBuilder {
1930    /// Mock latitude
1931    pub fn latitude(mut self, latitude: f64) -> Self { self.latitude = Some(latitude); self }
1932    /// Mock longitude
1933    pub fn longitude(mut self, longitude: f64) -> Self { self.longitude = Some(longitude); self }
1934    /// Mock accuracy
1935    pub fn accuracy(mut self, accuracy: f64) -> Self { self.accuracy = Some(accuracy); self }
1936    /// Mock altitude
1937    pub fn altitude(mut self, altitude: f64) -> Self { self.altitude = Some(altitude); self }
1938    /// Mock altitudeAccuracy
1939    pub fn altitude_accuracy(mut self, altitude_accuracy: f64) -> Self { self.altitude_accuracy = Some(altitude_accuracy); self }
1940    /// Mock heading
1941    pub fn heading(mut self, heading: f64) -> Self { self.heading = Some(heading); self }
1942    /// Mock speed
1943    pub fn speed(mut self, speed: f64) -> Self { self.speed = Some(speed); self }
1944    pub fn build(self) -> SetGeolocationOverrideParams {
1945        SetGeolocationOverrideParams {
1946            latitude: self.latitude,
1947            longitude: self.longitude,
1948            accuracy: self.accuracy,
1949            altitude: self.altitude,
1950            altitude_accuracy: self.altitude_accuracy,
1951            heading: self.heading,
1952            speed: self.speed,
1953        }
1954    }
1955}
1956
1957impl SetGeolocationOverrideParams { pub const METHOD: &'static str = "Emulation.setGeolocationOverride"; }
1958
1959impl<'a> crate::CdpCommand<'a> for SetGeolocationOverrideParams {
1960    const METHOD: &'static str = "Emulation.setGeolocationOverride";
1961    type Response = crate::EmptyReturns;
1962}
1963
1964
1965#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1966#[serde(rename_all = "camelCase")]
1967pub struct GetOverriddenSensorInformationParams {
1968    #[serde(rename = "type")]
1969    type_: SensorType,
1970}
1971
1972impl GetOverriddenSensorInformationParams {
1973    /// Creates a builder for this type with the required parameters:
1974    /// * `type_`: 
1975    pub fn builder(type_: impl Into<SensorType>) -> GetOverriddenSensorInformationParamsBuilder {
1976        GetOverriddenSensorInformationParamsBuilder {
1977            type_: type_.into(),
1978        }
1979    }
1980    pub fn type_(&self) -> &SensorType { &self.type_ }
1981}
1982
1983
1984pub struct GetOverriddenSensorInformationParamsBuilder {
1985    type_: SensorType,
1986}
1987
1988impl GetOverriddenSensorInformationParamsBuilder {
1989    pub fn build(self) -> GetOverriddenSensorInformationParams {
1990        GetOverriddenSensorInformationParams {
1991            type_: self.type_,
1992        }
1993    }
1994}
1995
1996
1997#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1998#[serde(rename_all = "camelCase")]
1999pub struct GetOverriddenSensorInformationReturns {
2000    #[serde(rename = "requestedSamplingFrequency")]
2001    requested_sampling_frequency: f64,
2002}
2003
2004impl GetOverriddenSensorInformationReturns {
2005    /// Creates a builder for this type with the required parameters:
2006    /// * `requested_sampling_frequency`: 
2007    pub fn builder(requested_sampling_frequency: f64) -> GetOverriddenSensorInformationReturnsBuilder {
2008        GetOverriddenSensorInformationReturnsBuilder {
2009            requested_sampling_frequency: requested_sampling_frequency,
2010        }
2011    }
2012    pub fn requested_sampling_frequency(&self) -> f64 { self.requested_sampling_frequency }
2013}
2014
2015
2016pub struct GetOverriddenSensorInformationReturnsBuilder {
2017    requested_sampling_frequency: f64,
2018}
2019
2020impl GetOverriddenSensorInformationReturnsBuilder {
2021    pub fn build(self) -> GetOverriddenSensorInformationReturns {
2022        GetOverriddenSensorInformationReturns {
2023            requested_sampling_frequency: self.requested_sampling_frequency,
2024        }
2025    }
2026}
2027
2028impl GetOverriddenSensorInformationParams { pub const METHOD: &'static str = "Emulation.getOverriddenSensorInformation"; }
2029
2030impl<'a> crate::CdpCommand<'a> for GetOverriddenSensorInformationParams {
2031    const METHOD: &'static str = "Emulation.getOverriddenSensorInformation";
2032    type Response = GetOverriddenSensorInformationReturns;
2033}
2034
2035/// Overrides a platform sensor of a given type. If |enabled| is true, calls to
2036/// Sensor.start() will use a virtual sensor as backend rather than fetching
2037/// data from a real hardware sensor. Otherwise, existing virtual
2038/// sensor-backend Sensor objects will fire an error event and new calls to
2039/// Sensor.start() will attempt to use a real sensor instead.
2040
2041#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2042#[serde(rename_all = "camelCase")]
2043pub struct SetSensorOverrideEnabledParams {
2044    enabled: bool,
2045    #[serde(rename = "type")]
2046    type_: SensorType,
2047    #[serde(skip_serializing_if = "Option::is_none")]
2048    metadata: Option<SensorMetadata>,
2049}
2050
2051impl SetSensorOverrideEnabledParams {
2052    /// Creates a builder for this type with the required parameters:
2053    /// * `enabled`: 
2054    /// * `type_`: 
2055    pub fn builder(enabled: bool, type_: impl Into<SensorType>) -> SetSensorOverrideEnabledParamsBuilder {
2056        SetSensorOverrideEnabledParamsBuilder {
2057            enabled: enabled,
2058            type_: type_.into(),
2059            metadata: None,
2060        }
2061    }
2062    pub fn enabled(&self) -> bool { self.enabled }
2063    pub fn type_(&self) -> &SensorType { &self.type_ }
2064    pub fn metadata(&self) -> Option<&SensorMetadata> { self.metadata.as_ref() }
2065}
2066
2067
2068pub struct SetSensorOverrideEnabledParamsBuilder {
2069    enabled: bool,
2070    type_: SensorType,
2071    metadata: Option<SensorMetadata>,
2072}
2073
2074impl SetSensorOverrideEnabledParamsBuilder {
2075    pub fn metadata(mut self, metadata: SensorMetadata) -> Self { self.metadata = Some(metadata); self }
2076    pub fn build(self) -> SetSensorOverrideEnabledParams {
2077        SetSensorOverrideEnabledParams {
2078            enabled: self.enabled,
2079            type_: self.type_,
2080            metadata: self.metadata,
2081        }
2082    }
2083}
2084
2085impl SetSensorOverrideEnabledParams { pub const METHOD: &'static str = "Emulation.setSensorOverrideEnabled"; }
2086
2087impl<'a> crate::CdpCommand<'a> for SetSensorOverrideEnabledParams {
2088    const METHOD: &'static str = "Emulation.setSensorOverrideEnabled";
2089    type Response = crate::EmptyReturns;
2090}
2091
2092/// Updates the sensor readings reported by a sensor type previously overridden
2093/// by setSensorOverrideEnabled.
2094
2095#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2096#[serde(rename_all = "camelCase")]
2097pub struct SetSensorOverrideReadingsParams {
2098    #[serde(rename = "type")]
2099    type_: SensorType,
2100    reading: SensorReading,
2101}
2102
2103impl SetSensorOverrideReadingsParams {
2104    /// Creates a builder for this type with the required parameters:
2105    /// * `type_`: 
2106    /// * `reading`: 
2107    pub fn builder(type_: impl Into<SensorType>, reading: SensorReading) -> SetSensorOverrideReadingsParamsBuilder {
2108        SetSensorOverrideReadingsParamsBuilder {
2109            type_: type_.into(),
2110            reading: reading,
2111        }
2112    }
2113    pub fn type_(&self) -> &SensorType { &self.type_ }
2114    pub fn reading(&self) -> &SensorReading { &self.reading }
2115}
2116
2117
2118pub struct SetSensorOverrideReadingsParamsBuilder {
2119    type_: SensorType,
2120    reading: SensorReading,
2121}
2122
2123impl SetSensorOverrideReadingsParamsBuilder {
2124    pub fn build(self) -> SetSensorOverrideReadingsParams {
2125        SetSensorOverrideReadingsParams {
2126            type_: self.type_,
2127            reading: self.reading,
2128        }
2129    }
2130}
2131
2132impl SetSensorOverrideReadingsParams { pub const METHOD: &'static str = "Emulation.setSensorOverrideReadings"; }
2133
2134impl<'a> crate::CdpCommand<'a> for SetSensorOverrideReadingsParams {
2135    const METHOD: &'static str = "Emulation.setSensorOverrideReadings";
2136    type Response = crate::EmptyReturns;
2137}
2138
2139/// Overrides a pressure source of a given type, as used by the Compute
2140/// Pressure API, so that updates to PressureObserver.observe() are provided
2141/// via setPressureStateOverride instead of being retrieved from
2142/// platform-provided telemetry data.
2143
2144#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2145#[serde(rename_all = "camelCase")]
2146pub struct SetPressureSourceOverrideEnabledParams {
2147    enabled: bool,
2148    source: PressureSource,
2149    #[serde(skip_serializing_if = "Option::is_none")]
2150    metadata: Option<PressureMetadata>,
2151}
2152
2153impl SetPressureSourceOverrideEnabledParams {
2154    /// Creates a builder for this type with the required parameters:
2155    /// * `enabled`: 
2156    /// * `source`: 
2157    pub fn builder(enabled: bool, source: impl Into<PressureSource>) -> SetPressureSourceOverrideEnabledParamsBuilder {
2158        SetPressureSourceOverrideEnabledParamsBuilder {
2159            enabled: enabled,
2160            source: source.into(),
2161            metadata: None,
2162        }
2163    }
2164    pub fn enabled(&self) -> bool { self.enabled }
2165    pub fn source(&self) -> &PressureSource { &self.source }
2166    pub fn metadata(&self) -> Option<&PressureMetadata> { self.metadata.as_ref() }
2167}
2168
2169
2170pub struct SetPressureSourceOverrideEnabledParamsBuilder {
2171    enabled: bool,
2172    source: PressureSource,
2173    metadata: Option<PressureMetadata>,
2174}
2175
2176impl SetPressureSourceOverrideEnabledParamsBuilder {
2177    pub fn metadata(mut self, metadata: PressureMetadata) -> Self { self.metadata = Some(metadata); self }
2178    pub fn build(self) -> SetPressureSourceOverrideEnabledParams {
2179        SetPressureSourceOverrideEnabledParams {
2180            enabled: self.enabled,
2181            source: self.source,
2182            metadata: self.metadata,
2183        }
2184    }
2185}
2186
2187impl SetPressureSourceOverrideEnabledParams { pub const METHOD: &'static str = "Emulation.setPressureSourceOverrideEnabled"; }
2188
2189impl<'a> crate::CdpCommand<'a> for SetPressureSourceOverrideEnabledParams {
2190    const METHOD: &'static str = "Emulation.setPressureSourceOverrideEnabled";
2191    type Response = crate::EmptyReturns;
2192}
2193
2194/// TODO: OBSOLETE: To remove when setPressureDataOverride is merged.
2195/// Provides a given pressure state that will be processed and eventually be
2196/// delivered to PressureObserver users. |source| must have been previously
2197/// overridden by setPressureSourceOverrideEnabled.
2198
2199#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2200#[serde(rename_all = "camelCase")]
2201pub struct SetPressureStateOverrideParams {
2202    source: PressureSource,
2203    state: PressureState,
2204}
2205
2206impl SetPressureStateOverrideParams {
2207    /// Creates a builder for this type with the required parameters:
2208    /// * `source`: 
2209    /// * `state`: 
2210    pub fn builder(source: impl Into<PressureSource>, state: impl Into<PressureState>) -> SetPressureStateOverrideParamsBuilder {
2211        SetPressureStateOverrideParamsBuilder {
2212            source: source.into(),
2213            state: state.into(),
2214        }
2215    }
2216    pub fn source(&self) -> &PressureSource { &self.source }
2217    pub fn state(&self) -> &PressureState { &self.state }
2218}
2219
2220
2221pub struct SetPressureStateOverrideParamsBuilder {
2222    source: PressureSource,
2223    state: PressureState,
2224}
2225
2226impl SetPressureStateOverrideParamsBuilder {
2227    pub fn build(self) -> SetPressureStateOverrideParams {
2228        SetPressureStateOverrideParams {
2229            source: self.source,
2230            state: self.state,
2231        }
2232    }
2233}
2234
2235impl SetPressureStateOverrideParams { pub const METHOD: &'static str = "Emulation.setPressureStateOverride"; }
2236
2237impl<'a> crate::CdpCommand<'a> for SetPressureStateOverrideParams {
2238    const METHOD: &'static str = "Emulation.setPressureStateOverride";
2239    type Response = crate::EmptyReturns;
2240}
2241
2242/// Provides a given pressure data set that will be processed and eventually be
2243/// delivered to PressureObserver users. |source| must have been previously
2244/// overridden by setPressureSourceOverrideEnabled.
2245
2246#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2247#[serde(rename_all = "camelCase")]
2248pub struct SetPressureDataOverrideParams {
2249    source: PressureSource,
2250    state: PressureState,
2251    #[serde(skip_serializing_if = "Option::is_none", rename = "ownContributionEstimate")]
2252    own_contribution_estimate: Option<f64>,
2253}
2254
2255impl SetPressureDataOverrideParams {
2256    /// Creates a builder for this type with the required parameters:
2257    /// * `source`: 
2258    /// * `state`: 
2259    pub fn builder(source: impl Into<PressureSource>, state: impl Into<PressureState>) -> SetPressureDataOverrideParamsBuilder {
2260        SetPressureDataOverrideParamsBuilder {
2261            source: source.into(),
2262            state: state.into(),
2263            own_contribution_estimate: None,
2264        }
2265    }
2266    pub fn source(&self) -> &PressureSource { &self.source }
2267    pub fn state(&self) -> &PressureState { &self.state }
2268    pub fn own_contribution_estimate(&self) -> Option<f64> { self.own_contribution_estimate }
2269}
2270
2271
2272pub struct SetPressureDataOverrideParamsBuilder {
2273    source: PressureSource,
2274    state: PressureState,
2275    own_contribution_estimate: Option<f64>,
2276}
2277
2278impl SetPressureDataOverrideParamsBuilder {
2279    pub fn own_contribution_estimate(mut self, own_contribution_estimate: f64) -> Self { self.own_contribution_estimate = Some(own_contribution_estimate); self }
2280    pub fn build(self) -> SetPressureDataOverrideParams {
2281        SetPressureDataOverrideParams {
2282            source: self.source,
2283            state: self.state,
2284            own_contribution_estimate: self.own_contribution_estimate,
2285        }
2286    }
2287}
2288
2289impl SetPressureDataOverrideParams { pub const METHOD: &'static str = "Emulation.setPressureDataOverride"; }
2290
2291impl<'a> crate::CdpCommand<'a> for SetPressureDataOverrideParams {
2292    const METHOD: &'static str = "Emulation.setPressureDataOverride";
2293    type Response = crate::EmptyReturns;
2294}
2295
2296/// Overrides the Idle state.
2297
2298#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2299#[serde(rename_all = "camelCase")]
2300pub struct SetIdleOverrideParams {
2301    /// Mock isUserActive
2302    #[serde(rename = "isUserActive")]
2303    is_user_active: bool,
2304    /// Mock isScreenUnlocked
2305    #[serde(rename = "isScreenUnlocked")]
2306    is_screen_unlocked: bool,
2307}
2308
2309impl SetIdleOverrideParams {
2310    /// Creates a builder for this type with the required parameters:
2311    /// * `is_user_active`: Mock isUserActive
2312    /// * `is_screen_unlocked`: Mock isScreenUnlocked
2313    pub fn builder(is_user_active: bool, is_screen_unlocked: bool) -> SetIdleOverrideParamsBuilder {
2314        SetIdleOverrideParamsBuilder {
2315            is_user_active: is_user_active,
2316            is_screen_unlocked: is_screen_unlocked,
2317        }
2318    }
2319    /// Mock isUserActive
2320    pub fn is_user_active(&self) -> bool { self.is_user_active }
2321    /// Mock isScreenUnlocked
2322    pub fn is_screen_unlocked(&self) -> bool { self.is_screen_unlocked }
2323}
2324
2325
2326pub struct SetIdleOverrideParamsBuilder {
2327    is_user_active: bool,
2328    is_screen_unlocked: bool,
2329}
2330
2331impl SetIdleOverrideParamsBuilder {
2332    pub fn build(self) -> SetIdleOverrideParams {
2333        SetIdleOverrideParams {
2334            is_user_active: self.is_user_active,
2335            is_screen_unlocked: self.is_screen_unlocked,
2336        }
2337    }
2338}
2339
2340impl SetIdleOverrideParams { pub const METHOD: &'static str = "Emulation.setIdleOverride"; }
2341
2342impl<'a> crate::CdpCommand<'a> for SetIdleOverrideParams {
2343    const METHOD: &'static str = "Emulation.setIdleOverride";
2344    type Response = crate::EmptyReturns;
2345}
2346
2347#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2348pub struct ClearIdleOverrideParams {}
2349
2350impl ClearIdleOverrideParams { pub const METHOD: &'static str = "Emulation.clearIdleOverride"; }
2351
2352impl<'a> crate::CdpCommand<'a> for ClearIdleOverrideParams {
2353    const METHOD: &'static str = "Emulation.clearIdleOverride";
2354    type Response = crate::EmptyReturns;
2355}
2356
2357/// Overrides value returned by the javascript navigator object.
2358
2359#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2360#[serde(rename_all = "camelCase")]
2361pub struct SetNavigatorOverridesParams<'a> {
2362    /// The platform navigator.platform should return.
2363    platform: Cow<'a, str>,
2364}
2365
2366impl<'a> SetNavigatorOverridesParams<'a> {
2367    /// Creates a builder for this type with the required parameters:
2368    /// * `platform`: The platform navigator.platform should return.
2369    pub fn builder(platform: impl Into<Cow<'a, str>>) -> SetNavigatorOverridesParamsBuilder<'a> {
2370        SetNavigatorOverridesParamsBuilder {
2371            platform: platform.into(),
2372        }
2373    }
2374    /// The platform navigator.platform should return.
2375    pub fn platform(&self) -> &str { self.platform.as_ref() }
2376}
2377
2378
2379pub struct SetNavigatorOverridesParamsBuilder<'a> {
2380    platform: Cow<'a, str>,
2381}
2382
2383impl<'a> SetNavigatorOverridesParamsBuilder<'a> {
2384    pub fn build(self) -> SetNavigatorOverridesParams<'a> {
2385        SetNavigatorOverridesParams {
2386            platform: self.platform,
2387        }
2388    }
2389}
2390
2391impl<'a> SetNavigatorOverridesParams<'a> { pub const METHOD: &'static str = "Emulation.setNavigatorOverrides"; }
2392
2393impl<'a> crate::CdpCommand<'a> for SetNavigatorOverridesParams<'a> {
2394    const METHOD: &'static str = "Emulation.setNavigatorOverrides";
2395    type Response = crate::EmptyReturns;
2396}
2397
2398/// Sets a specified page scale factor.
2399
2400#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2401#[serde(rename_all = "camelCase")]
2402pub struct SetPageScaleFactorParams {
2403    /// Page scale factor.
2404    #[serde(rename = "pageScaleFactor")]
2405    page_scale_factor: f64,
2406}
2407
2408impl SetPageScaleFactorParams {
2409    /// Creates a builder for this type with the required parameters:
2410    /// * `page_scale_factor`: Page scale factor.
2411    pub fn builder(page_scale_factor: f64) -> SetPageScaleFactorParamsBuilder {
2412        SetPageScaleFactorParamsBuilder {
2413            page_scale_factor: page_scale_factor,
2414        }
2415    }
2416    /// Page scale factor.
2417    pub fn page_scale_factor(&self) -> f64 { self.page_scale_factor }
2418}
2419
2420
2421pub struct SetPageScaleFactorParamsBuilder {
2422    page_scale_factor: f64,
2423}
2424
2425impl SetPageScaleFactorParamsBuilder {
2426    pub fn build(self) -> SetPageScaleFactorParams {
2427        SetPageScaleFactorParams {
2428            page_scale_factor: self.page_scale_factor,
2429        }
2430    }
2431}
2432
2433impl SetPageScaleFactorParams { pub const METHOD: &'static str = "Emulation.setPageScaleFactor"; }
2434
2435impl<'a> crate::CdpCommand<'a> for SetPageScaleFactorParams {
2436    const METHOD: &'static str = "Emulation.setPageScaleFactor";
2437    type Response = crate::EmptyReturns;
2438}
2439
2440/// Switches script execution in the page.
2441
2442#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2443#[serde(rename_all = "camelCase")]
2444pub struct SetScriptExecutionDisabledParams {
2445    /// Whether script execution should be disabled in the page.
2446    value: bool,
2447}
2448
2449impl SetScriptExecutionDisabledParams {
2450    /// Creates a builder for this type with the required parameters:
2451    /// * `value`: Whether script execution should be disabled in the page.
2452    pub fn builder(value: bool) -> SetScriptExecutionDisabledParamsBuilder {
2453        SetScriptExecutionDisabledParamsBuilder {
2454            value: value,
2455        }
2456    }
2457    /// Whether script execution should be disabled in the page.
2458    pub fn value(&self) -> bool { self.value }
2459}
2460
2461
2462pub struct SetScriptExecutionDisabledParamsBuilder {
2463    value: bool,
2464}
2465
2466impl SetScriptExecutionDisabledParamsBuilder {
2467    pub fn build(self) -> SetScriptExecutionDisabledParams {
2468        SetScriptExecutionDisabledParams {
2469            value: self.value,
2470        }
2471    }
2472}
2473
2474impl SetScriptExecutionDisabledParams { pub const METHOD: &'static str = "Emulation.setScriptExecutionDisabled"; }
2475
2476impl<'a> crate::CdpCommand<'a> for SetScriptExecutionDisabledParams {
2477    const METHOD: &'static str = "Emulation.setScriptExecutionDisabled";
2478    type Response = crate::EmptyReturns;
2479}
2480
2481/// Enables touch on platforms which do not support them.
2482
2483#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2484#[serde(rename_all = "camelCase")]
2485pub struct SetTouchEmulationEnabledParams {
2486    /// Whether the touch event emulation should be enabled.
2487    enabled: bool,
2488    /// Maximum touch points supported. Defaults to one.
2489    #[serde(skip_serializing_if = "Option::is_none", rename = "maxTouchPoints")]
2490    max_touch_points: Option<i64>,
2491}
2492
2493impl SetTouchEmulationEnabledParams {
2494    /// Creates a builder for this type with the required parameters:
2495    /// * `enabled`: Whether the touch event emulation should be enabled.
2496    pub fn builder(enabled: bool) -> SetTouchEmulationEnabledParamsBuilder {
2497        SetTouchEmulationEnabledParamsBuilder {
2498            enabled: enabled,
2499            max_touch_points: None,
2500        }
2501    }
2502    /// Whether the touch event emulation should be enabled.
2503    pub fn enabled(&self) -> bool { self.enabled }
2504    /// Maximum touch points supported. Defaults to one.
2505    pub fn max_touch_points(&self) -> Option<i64> { self.max_touch_points }
2506}
2507
2508
2509pub struct SetTouchEmulationEnabledParamsBuilder {
2510    enabled: bool,
2511    max_touch_points: Option<i64>,
2512}
2513
2514impl SetTouchEmulationEnabledParamsBuilder {
2515    /// Maximum touch points supported. Defaults to one.
2516    pub fn max_touch_points(mut self, max_touch_points: i64) -> Self { self.max_touch_points = Some(max_touch_points); self }
2517    pub fn build(self) -> SetTouchEmulationEnabledParams {
2518        SetTouchEmulationEnabledParams {
2519            enabled: self.enabled,
2520            max_touch_points: self.max_touch_points,
2521        }
2522    }
2523}
2524
2525impl SetTouchEmulationEnabledParams { pub const METHOD: &'static str = "Emulation.setTouchEmulationEnabled"; }
2526
2527impl<'a> crate::CdpCommand<'a> for SetTouchEmulationEnabledParams {
2528    const METHOD: &'static str = "Emulation.setTouchEmulationEnabled";
2529    type Response = crate::EmptyReturns;
2530}
2531
2532/// Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
2533/// the current virtual time policy.  Note this supersedes any previous time budget.
2534
2535#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2536#[serde(rename_all = "camelCase")]
2537pub struct SetVirtualTimePolicyParams {
2538    policy: VirtualTimePolicy,
2539    /// If set, after this many virtual milliseconds have elapsed virtual time will be paused and a
2540    /// virtualTimeBudgetExpired event is sent.
2541    #[serde(skip_serializing_if = "Option::is_none")]
2542    budget: Option<f64>,
2543    /// If set this specifies the maximum number of tasks that can be run before virtual is forced
2544    /// forwards to prevent deadlock.
2545    #[serde(skip_serializing_if = "Option::is_none", rename = "maxVirtualTimeTaskStarvationCount")]
2546    max_virtual_time_task_starvation_count: Option<u64>,
2547    /// If set, base::Time::Now will be overridden to initially return this value.
2548    #[serde(skip_serializing_if = "Option::is_none", rename = "initialVirtualTime")]
2549    initial_virtual_time: Option<crate::network::TimeSinceEpoch>,
2550}
2551
2552impl SetVirtualTimePolicyParams {
2553    /// Creates a builder for this type with the required parameters:
2554    /// * `policy`: 
2555    pub fn builder(policy: impl Into<VirtualTimePolicy>) -> SetVirtualTimePolicyParamsBuilder {
2556        SetVirtualTimePolicyParamsBuilder {
2557            policy: policy.into(),
2558            budget: None,
2559            max_virtual_time_task_starvation_count: None,
2560            initial_virtual_time: None,
2561        }
2562    }
2563    pub fn policy(&self) -> &VirtualTimePolicy { &self.policy }
2564    /// If set, after this many virtual milliseconds have elapsed virtual time will be paused and a
2565    /// virtualTimeBudgetExpired event is sent.
2566    pub fn budget(&self) -> Option<f64> { self.budget }
2567    /// If set this specifies the maximum number of tasks that can be run before virtual is forced
2568    /// forwards to prevent deadlock.
2569    pub fn max_virtual_time_task_starvation_count(&self) -> Option<u64> { self.max_virtual_time_task_starvation_count }
2570    /// If set, base::Time::Now will be overridden to initially return this value.
2571    pub fn initial_virtual_time(&self) -> Option<&crate::network::TimeSinceEpoch> { self.initial_virtual_time.as_ref() }
2572}
2573
2574
2575pub struct SetVirtualTimePolicyParamsBuilder {
2576    policy: VirtualTimePolicy,
2577    budget: Option<f64>,
2578    max_virtual_time_task_starvation_count: Option<u64>,
2579    initial_virtual_time: Option<crate::network::TimeSinceEpoch>,
2580}
2581
2582impl SetVirtualTimePolicyParamsBuilder {
2583    /// If set, after this many virtual milliseconds have elapsed virtual time will be paused and a
2584    /// virtualTimeBudgetExpired event is sent.
2585    pub fn budget(mut self, budget: f64) -> Self { self.budget = Some(budget); self }
2586    /// If set this specifies the maximum number of tasks that can be run before virtual is forced
2587    /// forwards to prevent deadlock.
2588    pub fn max_virtual_time_task_starvation_count(mut self, max_virtual_time_task_starvation_count: u64) -> Self { self.max_virtual_time_task_starvation_count = Some(max_virtual_time_task_starvation_count); self }
2589    /// If set, base::Time::Now will be overridden to initially return this value.
2590    pub fn initial_virtual_time(mut self, initial_virtual_time: crate::network::TimeSinceEpoch) -> Self { self.initial_virtual_time = Some(initial_virtual_time); self }
2591    pub fn build(self) -> SetVirtualTimePolicyParams {
2592        SetVirtualTimePolicyParams {
2593            policy: self.policy,
2594            budget: self.budget,
2595            max_virtual_time_task_starvation_count: self.max_virtual_time_task_starvation_count,
2596            initial_virtual_time: self.initial_virtual_time,
2597        }
2598    }
2599}
2600
2601/// Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
2602/// the current virtual time policy.  Note this supersedes any previous time budget.
2603
2604#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2605#[serde(rename_all = "camelCase")]
2606pub struct SetVirtualTimePolicyReturns {
2607    /// Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
2608    #[serde(rename = "virtualTimeTicksBase")]
2609    virtual_time_ticks_base: f64,
2610}
2611
2612impl SetVirtualTimePolicyReturns {
2613    /// Creates a builder for this type with the required parameters:
2614    /// * `virtual_time_ticks_base`: Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
2615    pub fn builder(virtual_time_ticks_base: f64) -> SetVirtualTimePolicyReturnsBuilder {
2616        SetVirtualTimePolicyReturnsBuilder {
2617            virtual_time_ticks_base: virtual_time_ticks_base,
2618        }
2619    }
2620    /// Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
2621    pub fn virtual_time_ticks_base(&self) -> f64 { self.virtual_time_ticks_base }
2622}
2623
2624
2625pub struct SetVirtualTimePolicyReturnsBuilder {
2626    virtual_time_ticks_base: f64,
2627}
2628
2629impl SetVirtualTimePolicyReturnsBuilder {
2630    pub fn build(self) -> SetVirtualTimePolicyReturns {
2631        SetVirtualTimePolicyReturns {
2632            virtual_time_ticks_base: self.virtual_time_ticks_base,
2633        }
2634    }
2635}
2636
2637impl SetVirtualTimePolicyParams { pub const METHOD: &'static str = "Emulation.setVirtualTimePolicy"; }
2638
2639impl<'a> crate::CdpCommand<'a> for SetVirtualTimePolicyParams {
2640    const METHOD: &'static str = "Emulation.setVirtualTimePolicy";
2641    type Response = SetVirtualTimePolicyReturns;
2642}
2643
2644/// Overrides default host system locale with the specified one.
2645
2646#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2647#[serde(rename_all = "camelCase")]
2648pub struct SetLocaleOverrideParams<'a> {
2649    /// ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and
2650    /// restores default host system locale.
2651    #[serde(skip_serializing_if = "Option::is_none")]
2652    locale: Option<Cow<'a, str>>,
2653}
2654
2655impl<'a> SetLocaleOverrideParams<'a> {
2656    /// Creates a builder for this type.
2657    pub fn builder() -> SetLocaleOverrideParamsBuilder<'a> {
2658        SetLocaleOverrideParamsBuilder {
2659            locale: None,
2660        }
2661    }
2662    /// ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and
2663    /// restores default host system locale.
2664    pub fn locale(&self) -> Option<&str> { self.locale.as_deref() }
2665}
2666
2667#[derive(Default)]
2668pub struct SetLocaleOverrideParamsBuilder<'a> {
2669    locale: Option<Cow<'a, str>>,
2670}
2671
2672impl<'a> SetLocaleOverrideParamsBuilder<'a> {
2673    /// ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and
2674    /// restores default host system locale.
2675    pub fn locale(mut self, locale: impl Into<Cow<'a, str>>) -> Self { self.locale = Some(locale.into()); self }
2676    pub fn build(self) -> SetLocaleOverrideParams<'a> {
2677        SetLocaleOverrideParams {
2678            locale: self.locale,
2679        }
2680    }
2681}
2682
2683impl<'a> SetLocaleOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setLocaleOverride"; }
2684
2685impl<'a> crate::CdpCommand<'a> for SetLocaleOverrideParams<'a> {
2686    const METHOD: &'static str = "Emulation.setLocaleOverride";
2687    type Response = crate::EmptyReturns;
2688}
2689
2690/// Overrides default host system timezone with the specified one.
2691
2692#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2693#[serde(rename_all = "camelCase")]
2694pub struct SetTimezoneOverrideParams<'a> {
2695    /// The timezone identifier. List of supported timezones:
2696    /// <https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt>
2697    /// If empty, disables the override and restores default host system timezone.
2698    #[serde(rename = "timezoneId")]
2699    timezone_id: Cow<'a, str>,
2700}
2701
2702impl<'a> SetTimezoneOverrideParams<'a> {
2703    /// Creates a builder for this type with the required parameters:
2704    /// * `timezone_id`: The timezone identifier. List of supported timezones: <https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt> If empty, disables the override and restores default host system timezone.
2705    pub fn builder(timezone_id: impl Into<Cow<'a, str>>) -> SetTimezoneOverrideParamsBuilder<'a> {
2706        SetTimezoneOverrideParamsBuilder {
2707            timezone_id: timezone_id.into(),
2708        }
2709    }
2710    /// The timezone identifier. List of supported timezones:
2711    /// <https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt>
2712    /// If empty, disables the override and restores default host system timezone.
2713    pub fn timezone_id(&self) -> &str { self.timezone_id.as_ref() }
2714}
2715
2716
2717pub struct SetTimezoneOverrideParamsBuilder<'a> {
2718    timezone_id: Cow<'a, str>,
2719}
2720
2721impl<'a> SetTimezoneOverrideParamsBuilder<'a> {
2722    pub fn build(self) -> SetTimezoneOverrideParams<'a> {
2723        SetTimezoneOverrideParams {
2724            timezone_id: self.timezone_id,
2725        }
2726    }
2727}
2728
2729impl<'a> SetTimezoneOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setTimezoneOverride"; }
2730
2731impl<'a> crate::CdpCommand<'a> for SetTimezoneOverrideParams<'a> {
2732    const METHOD: &'static str = "Emulation.setTimezoneOverride";
2733    type Response = crate::EmptyReturns;
2734}
2735
2736/// Resizes the frame/viewport of the page. Note that this does not affect the frame's container
2737/// (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported
2738/// on Android.
2739
2740#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2741#[serde(rename_all = "camelCase")]
2742pub struct SetVisibleSizeParams {
2743    /// Frame width (DIP).
2744    width: u64,
2745    /// Frame height (DIP).
2746    height: i64,
2747}
2748
2749impl SetVisibleSizeParams {
2750    /// Creates a builder for this type with the required parameters:
2751    /// * `width`: Frame width (DIP).
2752    /// * `height`: Frame height (DIP).
2753    pub fn builder(width: u64, height: i64) -> SetVisibleSizeParamsBuilder {
2754        SetVisibleSizeParamsBuilder {
2755            width: width,
2756            height: height,
2757        }
2758    }
2759    /// Frame width (DIP).
2760    pub fn width(&self) -> u64 { self.width }
2761    /// Frame height (DIP).
2762    pub fn height(&self) -> i64 { self.height }
2763}
2764
2765
2766pub struct SetVisibleSizeParamsBuilder {
2767    width: u64,
2768    height: i64,
2769}
2770
2771impl SetVisibleSizeParamsBuilder {
2772    pub fn build(self) -> SetVisibleSizeParams {
2773        SetVisibleSizeParams {
2774            width: self.width,
2775            height: self.height,
2776        }
2777    }
2778}
2779
2780impl SetVisibleSizeParams { pub const METHOD: &'static str = "Emulation.setVisibleSize"; }
2781
2782impl<'a> crate::CdpCommand<'a> for SetVisibleSizeParams {
2783    const METHOD: &'static str = "Emulation.setVisibleSize";
2784    type Response = crate::EmptyReturns;
2785}
2786
2787
2788#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2789#[serde(rename_all = "camelCase")]
2790pub struct SetDisabledImageTypesParams {
2791    /// Image types to disable.
2792    #[serde(rename = "imageTypes")]
2793    image_types: Vec<DisabledImageType>,
2794}
2795
2796impl SetDisabledImageTypesParams {
2797    /// Creates a builder for this type with the required parameters:
2798    /// * `image_types`: Image types to disable.
2799    pub fn builder(image_types: Vec<DisabledImageType>) -> SetDisabledImageTypesParamsBuilder {
2800        SetDisabledImageTypesParamsBuilder {
2801            image_types: image_types,
2802        }
2803    }
2804    /// Image types to disable.
2805    pub fn image_types(&self) -> &[DisabledImageType] { &self.image_types }
2806}
2807
2808
2809pub struct SetDisabledImageTypesParamsBuilder {
2810    image_types: Vec<DisabledImageType>,
2811}
2812
2813impl SetDisabledImageTypesParamsBuilder {
2814    pub fn build(self) -> SetDisabledImageTypesParams {
2815        SetDisabledImageTypesParams {
2816            image_types: self.image_types,
2817        }
2818    }
2819}
2820
2821impl SetDisabledImageTypesParams { pub const METHOD: &'static str = "Emulation.setDisabledImageTypes"; }
2822
2823impl<'a> crate::CdpCommand<'a> for SetDisabledImageTypesParams {
2824    const METHOD: &'static str = "Emulation.setDisabledImageTypes";
2825    type Response = crate::EmptyReturns;
2826}
2827
2828/// Override the value of navigator.connection.saveData
2829
2830#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2831#[serde(rename_all = "camelCase")]
2832pub struct SetDataSaverOverrideParams {
2833    /// Override value. Omitting the parameter disables the override.
2834    #[serde(skip_serializing_if = "Option::is_none", rename = "dataSaverEnabled")]
2835    data_saver_enabled: Option<bool>,
2836}
2837
2838impl SetDataSaverOverrideParams {
2839    /// Creates a builder for this type.
2840    pub fn builder() -> SetDataSaverOverrideParamsBuilder {
2841        SetDataSaverOverrideParamsBuilder {
2842            data_saver_enabled: None,
2843        }
2844    }
2845    /// Override value. Omitting the parameter disables the override.
2846    pub fn data_saver_enabled(&self) -> Option<bool> { self.data_saver_enabled }
2847}
2848
2849#[derive(Default)]
2850pub struct SetDataSaverOverrideParamsBuilder {
2851    data_saver_enabled: Option<bool>,
2852}
2853
2854impl SetDataSaverOverrideParamsBuilder {
2855    /// Override value. Omitting the parameter disables the override.
2856    pub fn data_saver_enabled(mut self, data_saver_enabled: bool) -> Self { self.data_saver_enabled = Some(data_saver_enabled); self }
2857    pub fn build(self) -> SetDataSaverOverrideParams {
2858        SetDataSaverOverrideParams {
2859            data_saver_enabled: self.data_saver_enabled,
2860        }
2861    }
2862}
2863
2864impl SetDataSaverOverrideParams { pub const METHOD: &'static str = "Emulation.setDataSaverOverride"; }
2865
2866impl<'a> crate::CdpCommand<'a> for SetDataSaverOverrideParams {
2867    const METHOD: &'static str = "Emulation.setDataSaverOverride";
2868    type Response = crate::EmptyReturns;
2869}
2870
2871
2872#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2873#[serde(rename_all = "camelCase")]
2874pub struct SetHardwareConcurrencyOverrideParams {
2875    /// Hardware concurrency to report
2876    #[serde(rename = "hardwareConcurrency")]
2877    hardware_concurrency: i64,
2878}
2879
2880impl SetHardwareConcurrencyOverrideParams {
2881    /// Creates a builder for this type with the required parameters:
2882    /// * `hardware_concurrency`: Hardware concurrency to report
2883    pub fn builder(hardware_concurrency: i64) -> SetHardwareConcurrencyOverrideParamsBuilder {
2884        SetHardwareConcurrencyOverrideParamsBuilder {
2885            hardware_concurrency: hardware_concurrency,
2886        }
2887    }
2888    /// Hardware concurrency to report
2889    pub fn hardware_concurrency(&self) -> i64 { self.hardware_concurrency }
2890}
2891
2892
2893pub struct SetHardwareConcurrencyOverrideParamsBuilder {
2894    hardware_concurrency: i64,
2895}
2896
2897impl SetHardwareConcurrencyOverrideParamsBuilder {
2898    pub fn build(self) -> SetHardwareConcurrencyOverrideParams {
2899        SetHardwareConcurrencyOverrideParams {
2900            hardware_concurrency: self.hardware_concurrency,
2901        }
2902    }
2903}
2904
2905impl SetHardwareConcurrencyOverrideParams { pub const METHOD: &'static str = "Emulation.setHardwareConcurrencyOverride"; }
2906
2907impl<'a> crate::CdpCommand<'a> for SetHardwareConcurrencyOverrideParams {
2908    const METHOD: &'static str = "Emulation.setHardwareConcurrencyOverride";
2909    type Response = crate::EmptyReturns;
2910}
2911
2912/// Allows overriding user agent with the given string.
2913/// 'userAgentMetadata' must be set for Client Hint headers to be sent.
2914
2915#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2916#[serde(rename_all = "camelCase")]
2917pub struct SetUserAgentOverrideParams<'a> {
2918    /// User agent to use.
2919    #[serde(rename = "userAgent")]
2920    user_agent: Cow<'a, str>,
2921    /// Browser language to emulate.
2922    #[serde(skip_serializing_if = "Option::is_none", rename = "acceptLanguage")]
2923    accept_language: Option<Cow<'a, str>>,
2924    /// The platform navigator.platform should return.
2925    #[serde(skip_serializing_if = "Option::is_none")]
2926    platform: Option<Cow<'a, str>>,
2927    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
2928    #[serde(skip_serializing_if = "Option::is_none", rename = "userAgentMetadata")]
2929    user_agent_metadata: Option<UserAgentMetadata<'a>>,
2930}
2931
2932impl<'a> SetUserAgentOverrideParams<'a> {
2933    /// Creates a builder for this type with the required parameters:
2934    /// * `user_agent`: User agent to use.
2935    pub fn builder(user_agent: impl Into<Cow<'a, str>>) -> SetUserAgentOverrideParamsBuilder<'a> {
2936        SetUserAgentOverrideParamsBuilder {
2937            user_agent: user_agent.into(),
2938            accept_language: None,
2939            platform: None,
2940            user_agent_metadata: None,
2941        }
2942    }
2943    /// User agent to use.
2944    pub fn user_agent(&self) -> &str { self.user_agent.as_ref() }
2945    /// Browser language to emulate.
2946    pub fn accept_language(&self) -> Option<&str> { self.accept_language.as_deref() }
2947    /// The platform navigator.platform should return.
2948    pub fn platform(&self) -> Option<&str> { self.platform.as_deref() }
2949    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
2950    pub fn user_agent_metadata(&self) -> Option<&UserAgentMetadata<'a>> { self.user_agent_metadata.as_ref() }
2951}
2952
2953
2954pub struct SetUserAgentOverrideParamsBuilder<'a> {
2955    user_agent: Cow<'a, str>,
2956    accept_language: Option<Cow<'a, str>>,
2957    platform: Option<Cow<'a, str>>,
2958    user_agent_metadata: Option<UserAgentMetadata<'a>>,
2959}
2960
2961impl<'a> SetUserAgentOverrideParamsBuilder<'a> {
2962    /// Browser language to emulate.
2963    pub fn accept_language(mut self, accept_language: impl Into<Cow<'a, str>>) -> Self { self.accept_language = Some(accept_language.into()); self }
2964    /// The platform navigator.platform should return.
2965    pub fn platform(mut self, platform: impl Into<Cow<'a, str>>) -> Self { self.platform = Some(platform.into()); self }
2966    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
2967    pub fn user_agent_metadata(mut self, user_agent_metadata: UserAgentMetadata<'a>) -> Self { self.user_agent_metadata = Some(user_agent_metadata); self }
2968    pub fn build(self) -> SetUserAgentOverrideParams<'a> {
2969        SetUserAgentOverrideParams {
2970            user_agent: self.user_agent,
2971            accept_language: self.accept_language,
2972            platform: self.platform,
2973            user_agent_metadata: self.user_agent_metadata,
2974        }
2975    }
2976}
2977
2978impl<'a> SetUserAgentOverrideParams<'a> { pub const METHOD: &'static str = "Emulation.setUserAgentOverride"; }
2979
2980impl<'a> crate::CdpCommand<'a> for SetUserAgentOverrideParams<'a> {
2981    const METHOD: &'static str = "Emulation.setUserAgentOverride";
2982    type Response = crate::EmptyReturns;
2983}
2984
2985/// Allows overriding the automation flag.
2986
2987#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2988#[serde(rename_all = "camelCase")]
2989pub struct SetAutomationOverrideParams {
2990    /// Whether the override should be enabled.
2991    enabled: bool,
2992}
2993
2994impl SetAutomationOverrideParams {
2995    /// Creates a builder for this type with the required parameters:
2996    /// * `enabled`: Whether the override should be enabled.
2997    pub fn builder(enabled: bool) -> SetAutomationOverrideParamsBuilder {
2998        SetAutomationOverrideParamsBuilder {
2999            enabled: enabled,
3000        }
3001    }
3002    /// Whether the override should be enabled.
3003    pub fn enabled(&self) -> bool { self.enabled }
3004}
3005
3006
3007pub struct SetAutomationOverrideParamsBuilder {
3008    enabled: bool,
3009}
3010
3011impl SetAutomationOverrideParamsBuilder {
3012    pub fn build(self) -> SetAutomationOverrideParams {
3013        SetAutomationOverrideParams {
3014            enabled: self.enabled,
3015        }
3016    }
3017}
3018
3019impl SetAutomationOverrideParams { pub const METHOD: &'static str = "Emulation.setAutomationOverride"; }
3020
3021impl<'a> crate::CdpCommand<'a> for SetAutomationOverrideParams {
3022    const METHOD: &'static str = "Emulation.setAutomationOverride";
3023    type Response = crate::EmptyReturns;
3024}
3025
3026/// Allows overriding the difference between the small and large viewport sizes, which determine the
3027/// value of the 'svh' and 'lvh' unit, respectively. Only supported for top-level frames.
3028
3029#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3030#[serde(rename_all = "camelCase")]
3031pub struct SetSmallViewportHeightDifferenceOverrideParams {
3032    /// This will cause an element of size 100svh to be 'difference' pixels smaller than an element
3033    /// of size 100lvh.
3034    difference: i64,
3035}
3036
3037impl SetSmallViewportHeightDifferenceOverrideParams {
3038    /// Creates a builder for this type with the required parameters:
3039    /// * `difference`: This will cause an element of size 100svh to be `difference` pixels smaller than an element of size 100lvh.
3040    pub fn builder(difference: i64) -> SetSmallViewportHeightDifferenceOverrideParamsBuilder {
3041        SetSmallViewportHeightDifferenceOverrideParamsBuilder {
3042            difference: difference,
3043        }
3044    }
3045    /// This will cause an element of size 100svh to be 'difference' pixels smaller than an element
3046    /// of size 100lvh.
3047    pub fn difference(&self) -> i64 { self.difference }
3048}
3049
3050
3051pub struct SetSmallViewportHeightDifferenceOverrideParamsBuilder {
3052    difference: i64,
3053}
3054
3055impl SetSmallViewportHeightDifferenceOverrideParamsBuilder {
3056    pub fn build(self) -> SetSmallViewportHeightDifferenceOverrideParams {
3057        SetSmallViewportHeightDifferenceOverrideParams {
3058            difference: self.difference,
3059        }
3060    }
3061}
3062
3063impl SetSmallViewportHeightDifferenceOverrideParams { pub const METHOD: &'static str = "Emulation.setSmallViewportHeightDifferenceOverride"; }
3064
3065impl<'a> crate::CdpCommand<'a> for SetSmallViewportHeightDifferenceOverrideParams {
3066    const METHOD: &'static str = "Emulation.setSmallViewportHeightDifferenceOverride";
3067    type Response = crate::EmptyReturns;
3068}
3069
3070/// Returns device's screen configuration. In headful mode, the physical screens configuration is returned,
3071/// whereas in headless mode, a virtual headless screen configuration is provided instead.
3072
3073#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3074#[serde(rename_all = "camelCase")]
3075pub struct GetScreenInfosReturns<'a> {
3076    #[serde(rename = "screenInfos")]
3077    screen_infos: Vec<ScreenInfo<'a>>,
3078}
3079
3080impl<'a> GetScreenInfosReturns<'a> {
3081    /// Creates a builder for this type with the required parameters:
3082    /// * `screen_infos`: 
3083    pub fn builder(screen_infos: Vec<ScreenInfo<'a>>) -> GetScreenInfosReturnsBuilder<'a> {
3084        GetScreenInfosReturnsBuilder {
3085            screen_infos: screen_infos,
3086        }
3087    }
3088    pub fn screen_infos(&self) -> &[ScreenInfo<'a>] { &self.screen_infos }
3089}
3090
3091
3092pub struct GetScreenInfosReturnsBuilder<'a> {
3093    screen_infos: Vec<ScreenInfo<'a>>,
3094}
3095
3096impl<'a> GetScreenInfosReturnsBuilder<'a> {
3097    pub fn build(self) -> GetScreenInfosReturns<'a> {
3098        GetScreenInfosReturns {
3099            screen_infos: self.screen_infos,
3100        }
3101    }
3102}
3103
3104#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3105pub struct GetScreenInfosParams {}
3106
3107impl GetScreenInfosParams { pub const METHOD: &'static str = "Emulation.getScreenInfos"; }
3108
3109impl<'a> crate::CdpCommand<'a> for GetScreenInfosParams {
3110    const METHOD: &'static str = "Emulation.getScreenInfos";
3111    type Response = GetScreenInfosReturns<'a>;
3112}
3113
3114/// Add a new screen to the device. Only supported in headless mode.
3115
3116#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3117#[serde(rename_all = "camelCase")]
3118pub struct AddScreenParams<'a> {
3119    /// Offset of the left edge of the screen in pixels.
3120    left: i64,
3121    /// Offset of the top edge of the screen in pixels.
3122    top: i64,
3123    /// The width of the screen in pixels.
3124    width: u64,
3125    /// The height of the screen in pixels.
3126    height: i64,
3127    /// Specifies the screen's work area. Default is entire screen.
3128    #[serde(skip_serializing_if = "Option::is_none", rename = "workAreaInsets")]
3129    work_area_insets: Option<WorkAreaInsets>,
3130    /// Specifies the screen's device pixel ratio. Default is 1.
3131    #[serde(skip_serializing_if = "Option::is_none", rename = "devicePixelRatio")]
3132    device_pixel_ratio: Option<f64>,
3133    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
3134    #[serde(skip_serializing_if = "Option::is_none")]
3135    rotation: Option<i64>,
3136    /// Specifies the screen's color depth in bits. Default is 24.
3137    #[serde(skip_serializing_if = "Option::is_none", rename = "colorDepth")]
3138    color_depth: Option<i64>,
3139    /// Specifies the descriptive label for the screen. Default is none.
3140    #[serde(skip_serializing_if = "Option::is_none")]
3141    label: Option<Cow<'a, str>>,
3142    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
3143    #[serde(skip_serializing_if = "Option::is_none", rename = "isInternal")]
3144    is_internal: Option<bool>,
3145}
3146
3147impl<'a> AddScreenParams<'a> {
3148    /// Creates a builder for this type with the required parameters:
3149    /// * `left`: Offset of the left edge of the screen in pixels.
3150    /// * `top`: Offset of the top edge of the screen in pixels.
3151    /// * `width`: The width of the screen in pixels.
3152    /// * `height`: The height of the screen in pixels.
3153    pub fn builder(left: i64, top: i64, width: u64, height: i64) -> AddScreenParamsBuilder<'a> {
3154        AddScreenParamsBuilder {
3155            left: left,
3156            top: top,
3157            width: width,
3158            height: height,
3159            work_area_insets: None,
3160            device_pixel_ratio: None,
3161            rotation: None,
3162            color_depth: None,
3163            label: None,
3164            is_internal: None,
3165        }
3166    }
3167    /// Offset of the left edge of the screen in pixels.
3168    pub fn left(&self) -> i64 { self.left }
3169    /// Offset of the top edge of the screen in pixels.
3170    pub fn top(&self) -> i64 { self.top }
3171    /// The width of the screen in pixels.
3172    pub fn width(&self) -> u64 { self.width }
3173    /// The height of the screen in pixels.
3174    pub fn height(&self) -> i64 { self.height }
3175    /// Specifies the screen's work area. Default is entire screen.
3176    pub fn work_area_insets(&self) -> Option<&WorkAreaInsets> { self.work_area_insets.as_ref() }
3177    /// Specifies the screen's device pixel ratio. Default is 1.
3178    pub fn device_pixel_ratio(&self) -> Option<f64> { self.device_pixel_ratio }
3179    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
3180    pub fn rotation(&self) -> Option<i64> { self.rotation }
3181    /// Specifies the screen's color depth in bits. Default is 24.
3182    pub fn color_depth(&self) -> Option<i64> { self.color_depth }
3183    /// Specifies the descriptive label for the screen. Default is none.
3184    pub fn label(&self) -> Option<&str> { self.label.as_deref() }
3185    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
3186    pub fn is_internal(&self) -> Option<bool> { self.is_internal }
3187}
3188
3189
3190pub struct AddScreenParamsBuilder<'a> {
3191    left: i64,
3192    top: i64,
3193    width: u64,
3194    height: i64,
3195    work_area_insets: Option<WorkAreaInsets>,
3196    device_pixel_ratio: Option<f64>,
3197    rotation: Option<i64>,
3198    color_depth: Option<i64>,
3199    label: Option<Cow<'a, str>>,
3200    is_internal: Option<bool>,
3201}
3202
3203impl<'a> AddScreenParamsBuilder<'a> {
3204    /// Specifies the screen's work area. Default is entire screen.
3205    pub fn work_area_insets(mut self, work_area_insets: WorkAreaInsets) -> Self { self.work_area_insets = Some(work_area_insets); self }
3206    /// Specifies the screen's device pixel ratio. Default is 1.
3207    pub fn device_pixel_ratio(mut self, device_pixel_ratio: f64) -> Self { self.device_pixel_ratio = Some(device_pixel_ratio); self }
3208    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
3209    pub fn rotation(mut self, rotation: i64) -> Self { self.rotation = Some(rotation); self }
3210    /// Specifies the screen's color depth in bits. Default is 24.
3211    pub fn color_depth(mut self, color_depth: i64) -> Self { self.color_depth = Some(color_depth); self }
3212    /// Specifies the descriptive label for the screen. Default is none.
3213    pub fn label(mut self, label: impl Into<Cow<'a, str>>) -> Self { self.label = Some(label.into()); self }
3214    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
3215    pub fn is_internal(mut self, is_internal: bool) -> Self { self.is_internal = Some(is_internal); self }
3216    pub fn build(self) -> AddScreenParams<'a> {
3217        AddScreenParams {
3218            left: self.left,
3219            top: self.top,
3220            width: self.width,
3221            height: self.height,
3222            work_area_insets: self.work_area_insets,
3223            device_pixel_ratio: self.device_pixel_ratio,
3224            rotation: self.rotation,
3225            color_depth: self.color_depth,
3226            label: self.label,
3227            is_internal: self.is_internal,
3228        }
3229    }
3230}
3231
3232/// Add a new screen to the device. Only supported in headless mode.
3233
3234#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3235#[serde(rename_all = "camelCase")]
3236pub struct AddScreenReturns<'a> {
3237    #[serde(rename = "screenInfo")]
3238    screen_info: ScreenInfo<'a>,
3239}
3240
3241impl<'a> AddScreenReturns<'a> {
3242    /// Creates a builder for this type with the required parameters:
3243    /// * `screen_info`: 
3244    pub fn builder(screen_info: ScreenInfo<'a>) -> AddScreenReturnsBuilder<'a> {
3245        AddScreenReturnsBuilder {
3246            screen_info: screen_info,
3247        }
3248    }
3249    pub fn screen_info(&self) -> &ScreenInfo<'a> { &self.screen_info }
3250}
3251
3252
3253pub struct AddScreenReturnsBuilder<'a> {
3254    screen_info: ScreenInfo<'a>,
3255}
3256
3257impl<'a> AddScreenReturnsBuilder<'a> {
3258    pub fn build(self) -> AddScreenReturns<'a> {
3259        AddScreenReturns {
3260            screen_info: self.screen_info,
3261        }
3262    }
3263}
3264
3265impl<'a> AddScreenParams<'a> { pub const METHOD: &'static str = "Emulation.addScreen"; }
3266
3267impl<'a> crate::CdpCommand<'a> for AddScreenParams<'a> {
3268    const METHOD: &'static str = "Emulation.addScreen";
3269    type Response = AddScreenReturns<'a>;
3270}
3271
3272/// Updates specified screen parameters. Only supported in headless mode.
3273
3274#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3275#[serde(rename_all = "camelCase")]
3276pub struct UpdateScreenParams<'a> {
3277    /// Target screen identifier.
3278    #[serde(rename = "screenId")]
3279    screen_id: ScreenId<'a>,
3280    /// Offset of the left edge of the screen in pixels.
3281    #[serde(skip_serializing_if = "Option::is_none")]
3282    left: Option<i64>,
3283    /// Offset of the top edge of the screen in pixels.
3284    #[serde(skip_serializing_if = "Option::is_none")]
3285    top: Option<i64>,
3286    /// The width of the screen in pixels.
3287    #[serde(skip_serializing_if = "Option::is_none")]
3288    width: Option<u64>,
3289    /// The height of the screen in pixels.
3290    #[serde(skip_serializing_if = "Option::is_none")]
3291    height: Option<i64>,
3292    /// Specifies the screen's work area.
3293    #[serde(skip_serializing_if = "Option::is_none", rename = "workAreaInsets")]
3294    work_area_insets: Option<WorkAreaInsets>,
3295    /// Specifies the screen's device pixel ratio.
3296    #[serde(skip_serializing_if = "Option::is_none", rename = "devicePixelRatio")]
3297    device_pixel_ratio: Option<f64>,
3298    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270.
3299    #[serde(skip_serializing_if = "Option::is_none")]
3300    rotation: Option<i64>,
3301    /// Specifies the screen's color depth in bits.
3302    #[serde(skip_serializing_if = "Option::is_none", rename = "colorDepth")]
3303    color_depth: Option<i64>,
3304    /// Specifies the descriptive label for the screen.
3305    #[serde(skip_serializing_if = "Option::is_none")]
3306    label: Option<Cow<'a, str>>,
3307    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
3308    #[serde(skip_serializing_if = "Option::is_none", rename = "isInternal")]
3309    is_internal: Option<bool>,
3310}
3311
3312impl<'a> UpdateScreenParams<'a> {
3313    /// Creates a builder for this type with the required parameters:
3314    /// * `screen_id`: Target screen identifier.
3315    pub fn builder(screen_id: impl Into<ScreenId<'a>>) -> UpdateScreenParamsBuilder<'a> {
3316        UpdateScreenParamsBuilder {
3317            screen_id: screen_id.into(),
3318            left: None,
3319            top: None,
3320            width: None,
3321            height: None,
3322            work_area_insets: None,
3323            device_pixel_ratio: None,
3324            rotation: None,
3325            color_depth: None,
3326            label: None,
3327            is_internal: None,
3328        }
3329    }
3330    /// Target screen identifier.
3331    pub fn screen_id(&self) -> &ScreenId<'a> { &self.screen_id }
3332    /// Offset of the left edge of the screen in pixels.
3333    pub fn left(&self) -> Option<i64> { self.left }
3334    /// Offset of the top edge of the screen in pixels.
3335    pub fn top(&self) -> Option<i64> { self.top }
3336    /// The width of the screen in pixels.
3337    pub fn width(&self) -> Option<u64> { self.width }
3338    /// The height of the screen in pixels.
3339    pub fn height(&self) -> Option<i64> { self.height }
3340    /// Specifies the screen's work area.
3341    pub fn work_area_insets(&self) -> Option<&WorkAreaInsets> { self.work_area_insets.as_ref() }
3342    /// Specifies the screen's device pixel ratio.
3343    pub fn device_pixel_ratio(&self) -> Option<f64> { self.device_pixel_ratio }
3344    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270.
3345    pub fn rotation(&self) -> Option<i64> { self.rotation }
3346    /// Specifies the screen's color depth in bits.
3347    pub fn color_depth(&self) -> Option<i64> { self.color_depth }
3348    /// Specifies the descriptive label for the screen.
3349    pub fn label(&self) -> Option<&str> { self.label.as_deref() }
3350    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
3351    pub fn is_internal(&self) -> Option<bool> { self.is_internal }
3352}
3353
3354
3355pub struct UpdateScreenParamsBuilder<'a> {
3356    screen_id: ScreenId<'a>,
3357    left: Option<i64>,
3358    top: Option<i64>,
3359    width: Option<u64>,
3360    height: Option<i64>,
3361    work_area_insets: Option<WorkAreaInsets>,
3362    device_pixel_ratio: Option<f64>,
3363    rotation: Option<i64>,
3364    color_depth: Option<i64>,
3365    label: Option<Cow<'a, str>>,
3366    is_internal: Option<bool>,
3367}
3368
3369impl<'a> UpdateScreenParamsBuilder<'a> {
3370    /// Offset of the left edge of the screen in pixels.
3371    pub fn left(mut self, left: i64) -> Self { self.left = Some(left); self }
3372    /// Offset of the top edge of the screen in pixels.
3373    pub fn top(mut self, top: i64) -> Self { self.top = Some(top); self }
3374    /// The width of the screen in pixels.
3375    pub fn width(mut self, width: u64) -> Self { self.width = Some(width); self }
3376    /// The height of the screen in pixels.
3377    pub fn height(mut self, height: i64) -> Self { self.height = Some(height); self }
3378    /// Specifies the screen's work area.
3379    pub fn work_area_insets(mut self, work_area_insets: WorkAreaInsets) -> Self { self.work_area_insets = Some(work_area_insets); self }
3380    /// Specifies the screen's device pixel ratio.
3381    pub fn device_pixel_ratio(mut self, device_pixel_ratio: f64) -> Self { self.device_pixel_ratio = Some(device_pixel_ratio); self }
3382    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270.
3383    pub fn rotation(mut self, rotation: i64) -> Self { self.rotation = Some(rotation); self }
3384    /// Specifies the screen's color depth in bits.
3385    pub fn color_depth(mut self, color_depth: i64) -> Self { self.color_depth = Some(color_depth); self }
3386    /// Specifies the descriptive label for the screen.
3387    pub fn label(mut self, label: impl Into<Cow<'a, str>>) -> Self { self.label = Some(label.into()); self }
3388    /// Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
3389    pub fn is_internal(mut self, is_internal: bool) -> Self { self.is_internal = Some(is_internal); self }
3390    pub fn build(self) -> UpdateScreenParams<'a> {
3391        UpdateScreenParams {
3392            screen_id: self.screen_id,
3393            left: self.left,
3394            top: self.top,
3395            width: self.width,
3396            height: self.height,
3397            work_area_insets: self.work_area_insets,
3398            device_pixel_ratio: self.device_pixel_ratio,
3399            rotation: self.rotation,
3400            color_depth: self.color_depth,
3401            label: self.label,
3402            is_internal: self.is_internal,
3403        }
3404    }
3405}
3406
3407/// Updates specified screen parameters. Only supported in headless mode.
3408
3409#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3410#[serde(rename_all = "camelCase")]
3411pub struct UpdateScreenReturns<'a> {
3412    #[serde(rename = "screenInfo")]
3413    screen_info: ScreenInfo<'a>,
3414}
3415
3416impl<'a> UpdateScreenReturns<'a> {
3417    /// Creates a builder for this type with the required parameters:
3418    /// * `screen_info`: 
3419    pub fn builder(screen_info: ScreenInfo<'a>) -> UpdateScreenReturnsBuilder<'a> {
3420        UpdateScreenReturnsBuilder {
3421            screen_info: screen_info,
3422        }
3423    }
3424    pub fn screen_info(&self) -> &ScreenInfo<'a> { &self.screen_info }
3425}
3426
3427
3428pub struct UpdateScreenReturnsBuilder<'a> {
3429    screen_info: ScreenInfo<'a>,
3430}
3431
3432impl<'a> UpdateScreenReturnsBuilder<'a> {
3433    pub fn build(self) -> UpdateScreenReturns<'a> {
3434        UpdateScreenReturns {
3435            screen_info: self.screen_info,
3436        }
3437    }
3438}
3439
3440impl<'a> UpdateScreenParams<'a> { pub const METHOD: &'static str = "Emulation.updateScreen"; }
3441
3442impl<'a> crate::CdpCommand<'a> for UpdateScreenParams<'a> {
3443    const METHOD: &'static str = "Emulation.updateScreen";
3444    type Response = UpdateScreenReturns<'a>;
3445}
3446
3447/// Remove screen from the device. Only supported in headless mode.
3448
3449#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3450#[serde(rename_all = "camelCase")]
3451pub struct RemoveScreenParams<'a> {
3452    #[serde(rename = "screenId")]
3453    screen_id: ScreenId<'a>,
3454}
3455
3456impl<'a> RemoveScreenParams<'a> {
3457    /// Creates a builder for this type with the required parameters:
3458    /// * `screen_id`: 
3459    pub fn builder(screen_id: impl Into<ScreenId<'a>>) -> RemoveScreenParamsBuilder<'a> {
3460        RemoveScreenParamsBuilder {
3461            screen_id: screen_id.into(),
3462        }
3463    }
3464    pub fn screen_id(&self) -> &ScreenId<'a> { &self.screen_id }
3465}
3466
3467
3468pub struct RemoveScreenParamsBuilder<'a> {
3469    screen_id: ScreenId<'a>,
3470}
3471
3472impl<'a> RemoveScreenParamsBuilder<'a> {
3473    pub fn build(self) -> RemoveScreenParams<'a> {
3474        RemoveScreenParams {
3475            screen_id: self.screen_id,
3476        }
3477    }
3478}
3479
3480impl<'a> RemoveScreenParams<'a> { pub const METHOD: &'static str = "Emulation.removeScreen"; }
3481
3482impl<'a> crate::CdpCommand<'a> for RemoveScreenParams<'a> {
3483    const METHOD: &'static str = "Emulation.removeScreen";
3484    type Response = crate::EmptyReturns;
3485}
3486
3487/// Set primary screen. Only supported in headless mode.
3488/// Note that this changes the coordinate system origin to the top-left
3489/// of the new primary screen, updating the bounds and work areas
3490/// of all existing screens accordingly.
3491
3492#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3493#[serde(rename_all = "camelCase")]
3494pub struct SetPrimaryScreenParams<'a> {
3495    #[serde(rename = "screenId")]
3496    screen_id: ScreenId<'a>,
3497}
3498
3499impl<'a> SetPrimaryScreenParams<'a> {
3500    /// Creates a builder for this type with the required parameters:
3501    /// * `screen_id`: 
3502    pub fn builder(screen_id: impl Into<ScreenId<'a>>) -> SetPrimaryScreenParamsBuilder<'a> {
3503        SetPrimaryScreenParamsBuilder {
3504            screen_id: screen_id.into(),
3505        }
3506    }
3507    pub fn screen_id(&self) -> &ScreenId<'a> { &self.screen_id }
3508}
3509
3510
3511pub struct SetPrimaryScreenParamsBuilder<'a> {
3512    screen_id: ScreenId<'a>,
3513}
3514
3515impl<'a> SetPrimaryScreenParamsBuilder<'a> {
3516    pub fn build(self) -> SetPrimaryScreenParams<'a> {
3517        SetPrimaryScreenParams {
3518            screen_id: self.screen_id,
3519        }
3520    }
3521}
3522
3523impl<'a> SetPrimaryScreenParams<'a> { pub const METHOD: &'static str = "Emulation.setPrimaryScreen"; }
3524
3525impl<'a> crate::CdpCommand<'a> for SetPrimaryScreenParams<'a> {
3526    const METHOD: &'static str = "Emulation.setPrimaryScreen";
3527    type Response = crate::EmptyReturns;
3528}