cdp-driver 0.5.0

Chrome DevTools Protocol (CDP) client for Rust: every command, event and type generated from the schema, with sessions, for browser automation and AI agents
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.

//! This domain emulates different environments for the page.
//!
//! Types, command parameters and event payloads for the `Emulation`
//! domain. The method-name constants for the same domain are in
//! [`crate::methods`].

use serde::{Deserialize, Serialize};

/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SafeAreaInsets {
    /// Overrides safe-area-inset-top.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub top: Option<i64>,
    /// Overrides safe-area-max-inset-top.
    #[serde(rename = "topMax", default, skip_serializing_if = "Option::is_none")]
    pub top_max: Option<i64>,
    /// Overrides safe-area-inset-left.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub left: Option<i64>,
    /// Overrides safe-area-max-inset-left.
    #[serde(rename = "leftMax", default, skip_serializing_if = "Option::is_none")]
    pub left_max: Option<i64>,
    /// Overrides safe-area-inset-bottom.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub bottom: Option<i64>,
    /// Overrides safe-area-max-inset-bottom.
    #[serde(rename = "bottomMax", default, skip_serializing_if = "Option::is_none")]
    pub bottom_max: Option<i64>,
    /// Overrides safe-area-inset-right.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub right: Option<i64>,
    /// Overrides safe-area-max-inset-right.
    #[serde(rename = "rightMax", default, skip_serializing_if = "Option::is_none")]
    pub right_max: Option<i64>,
}

/// Screen orientation.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ScreenOrientation {
    /// Orientation type.
    pub r#type: ScreenOrientationType,
    /// Orientation angle.
    pub angle: i64,
}

/// The values `type` accepts on `ScreenOrientation`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ScreenOrientationType {
    /// `portraitPrimary`
    #[serde(rename = "portraitPrimary")]
    PortraitPrimary,
    /// `portraitSecondary`
    #[serde(rename = "portraitSecondary")]
    PortraitSecondary,
    /// `landscapePrimary`
    #[serde(rename = "landscapePrimary")]
    LandscapePrimary,
    /// `landscapeSecondary`
    #[serde(rename = "landscapeSecondary")]
    LandscapeSecondary,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DisplayFeature {
    /// Orientation of a display feature in relation to screen
    pub orientation: DisplayFeatureOrientation,
    /// The offset from the screen origin in either the x (for vertical
    /// orientation) or y (for horizontal orientation) direction.
    pub offset: i64,
    /// 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.
    #[serde(rename = "maskLength")]
    pub mask_length: i64,
}

/// The values `orientation` accepts on `DisplayFeature`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DisplayFeatureOrientation {
    /// `vertical`
    #[serde(rename = "vertical")]
    Vertical,
    /// `horizontal`
    #[serde(rename = "horizontal")]
    Horizontal,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DevicePosture {
    /// Current posture of the device
    pub r#type: DevicePostureType,
}

/// The values `type` accepts on `DevicePosture`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DevicePostureType {
    /// `continuous`
    #[serde(rename = "continuous")]
    Continuous,
    /// `folded`
    #[serde(rename = "folded")]
    Folded,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct MediaFeature {
    pub name: String,
    pub value: String,
}

/// advance: If the scheduler runs out of immediate work, the virtual time
/// base may fast forward to allow the next delayed task (if any) to run;
/// pause: The virtual time base may not advance;
/// pauseIfNetworkFetchesPending: The virtual time base may not advance if
/// there are any pending resource fetches.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum VirtualTimePolicy {
    /// `advance`
    #[serde(rename = "advance")]
    Advance,
    /// `pause`
    #[serde(rename = "pause")]
    Pause,
    /// `pauseIfNetworkFetchesPending`
    #[serde(rename = "pauseIfNetworkFetchesPending")]
    PauseIfNetworkFetchesPending,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// Used to specify User Agent Client Hints to emulate. See
/// <https://wicg.github.io/ua-client-hints>
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct UserAgentBrandVersion {
    pub brand: String,
    pub version: String,
}

/// Used to specify User Agent Client Hints to emulate. See
/// <https://wicg.github.io/ua-client-hints> Missing optional values will be
/// filled in by the target with what it would normally use.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct UserAgentMetadata {
    /// Brands appearing in Sec-CH-UA.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub brands: Option<Vec<UserAgentBrandVersion>>,
    /// Brands appearing in Sec-CH-UA-Full-Version-List.
    #[serde(
        rename = "fullVersionList",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub full_version_list: Option<Vec<UserAgentBrandVersion>>,
    /// Deprecated in the protocol.
    #[serde(
        rename = "fullVersion",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub full_version: Option<String>,
    pub platform: String,
    #[serde(rename = "platformVersion")]
    pub platform_version: String,
    pub architecture: String,
    pub model: String,
    pub mobile: bool,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub bitness: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub wow64: Option<bool>,
    /// Used to specify User Agent form-factor values. See
    /// <https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors>
    #[serde(
        rename = "formFactors",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub form_factors: Option<Vec<String>>,
}

/// Used to specify sensor types to emulate. See
/// <https://w3c.github.io/sensors/#automation> for more information.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SensorType {
    /// `absolute-orientation`
    #[serde(rename = "absolute-orientation")]
    AbsoluteOrientation,
    /// `accelerometer`
    #[serde(rename = "accelerometer")]
    Accelerometer,
    /// `ambient-light`
    #[serde(rename = "ambient-light")]
    AmbientLight,
    /// `gravity`
    #[serde(rename = "gravity")]
    Gravity,
    /// `gyroscope`
    #[serde(rename = "gyroscope")]
    Gyroscope,
    /// `linear-acceleration`
    #[serde(rename = "linear-acceleration")]
    LinearAcceleration,
    /// `magnetometer`
    #[serde(rename = "magnetometer")]
    Magnetometer,
    /// `relative-orientation`
    #[serde(rename = "relative-orientation")]
    RelativeOrientation,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SensorMetadata {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub available: Option<bool>,
    #[serde(
        rename = "minimumFrequency",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub minimum_frequency: Option<f64>,
    #[serde(
        rename = "maximumFrequency",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub maximum_frequency: Option<f64>,
}

/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SensorReadingSingle {
    pub value: f64,
}

/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SensorReadingXyz {
    pub x: f64,
    pub y: f64,
    pub z: f64,
}

/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SensorReadingQuaternion {
    pub x: f64,
    pub y: f64,
    pub z: f64,
    pub w: f64,
}

/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SensorReading {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub single: Option<SensorReadingSingle>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub xyz: Option<SensorReadingXyz>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub quaternion: Option<SensorReadingQuaternion>,
}

/// Experimental: may change without notice.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PressureSource {
    /// `cpu`
    #[serde(rename = "cpu")]
    Cpu,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// Experimental: may change without notice.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PressureState {
    /// `nominal`
    #[serde(rename = "nominal")]
    Nominal,
    /// `fair`
    #[serde(rename = "fair")]
    Fair,
    /// `serious`
    #[serde(rename = "serious")]
    Serious,
    /// `critical`
    #[serde(rename = "critical")]
    Critical,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct PressureMetadata {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub available: Option<bool>,
}

/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct WorkAreaInsets {
    /// Work area top inset in pixels. Default is 0;
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub top: Option<i64>,
    /// Work area left inset in pixels. Default is 0;
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub left: Option<i64>,
    /// Work area bottom inset in pixels. Default is 0;
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub bottom: Option<i64>,
    /// Work area right inset in pixels. Default is 0;
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub right: Option<i64>,
}

/// Experimental: may change without notice.
pub type ScreenId = String;

/// Screen information similar to the one returned by
/// window.getScreenDetails() method, see
/// <https://w3c.github.io/window-management/#screendetailed>.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ScreenInfo {
    /// Offset of the left edge of the screen.
    pub left: i64,
    /// Offset of the top edge of the screen.
    pub top: i64,
    /// Width of the screen.
    pub width: i64,
    /// Height of the screen.
    pub height: i64,
    /// Offset of the left edge of the available screen area.
    #[serde(rename = "availLeft")]
    pub avail_left: i64,
    /// Offset of the top edge of the available screen area.
    #[serde(rename = "availTop")]
    pub avail_top: i64,
    /// Width of the available screen area.
    #[serde(rename = "availWidth")]
    pub avail_width: i64,
    /// Height of the available screen area.
    #[serde(rename = "availHeight")]
    pub avail_height: i64,
    /// Specifies the screen's device pixel ratio.
    #[serde(rename = "devicePixelRatio")]
    pub device_pixel_ratio: f64,
    /// Specifies the screen's orientation.
    pub orientation: ScreenOrientation,
    /// Specifies the screen's color depth in bits.
    #[serde(rename = "colorDepth")]
    pub color_depth: i64,
    /// Indicates whether the device has multiple screens.
    #[serde(rename = "isExtended")]
    pub is_extended: bool,
    /// Indicates whether the screen is internal to the device or external,
    /// attached to the device.
    #[serde(rename = "isInternal")]
    pub is_internal: bool,
    /// Indicates whether the screen is set as the the operating system primary
    /// screen.
    #[serde(rename = "isPrimary")]
    pub is_primary: bool,
    /// Specifies the descriptive label for the screen.
    pub label: String,
    /// Specifies the unique identifier of the screen.
    pub id: ScreenId,
}

/// Enum of image types that can be disabled.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DisabledImageType {
    /// `avif`
    #[serde(rename = "avif")]
    Avif,
    /// `jxl`
    #[serde(rename = "jxl")]
    Jxl,
    /// `webp`
    #[serde(rename = "webp")]
    Webp,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// Tells whether emulation is supported.
///
/// Deprecated in the protocol.
///
/// Parameters of `Emulation.canEmulate`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CanEmulateParams {}

/// What `Emulation.canEmulate` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CanEmulateReturns {
    /// True if emulation is supported.
    pub result: bool,
}

impl crate::typed::Command for CanEmulateParams {
    const METHOD: &'static str = "Emulation.canEmulate";
    type Returns = CanEmulateReturns;
}

/// Clears the overridden device metrics.
///
/// Parameters of `Emulation.clearDeviceMetricsOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearDeviceMetricsOverrideParams {}

impl crate::typed::Command for ClearDeviceMetricsOverrideParams {
    const METHOD: &'static str = "Emulation.clearDeviceMetricsOverride";
    type Returns = crate::typed::NoReturns;
}

/// Clears the overridden Geolocation Position and Error.
///
/// Parameters of `Emulation.clearGeolocationOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearGeolocationOverrideParams {}

impl crate::typed::Command for ClearGeolocationOverrideParams {
    const METHOD: &'static str = "Emulation.clearGeolocationOverride";
    type Returns = crate::typed::NoReturns;
}

/// Requests that page scale factor is reset to initial values.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.resetPageScaleFactor`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ResetPageScaleFactorParams {}

impl crate::typed::Command for ResetPageScaleFactorParams {
    const METHOD: &'static str = "Emulation.resetPageScaleFactor";
    type Returns = crate::typed::NoReturns;
}

/// Enables or disables simulating a focused and active page.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setFocusEmulationEnabled`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetFocusEmulationEnabledParams {
    /// Whether to enable to disable focus emulation.
    pub enabled: bool,
}

impl crate::typed::Command for SetFocusEmulationEnabledParams {
    const METHOD: &'static str = "Emulation.setFocusEmulationEnabled";
    type Returns = crate::typed::NoReturns;
}

/// Automatically render all web contents using a dark theme.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setAutoDarkModeOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetAutoDarkModeOverrideParams {
    /// Whether to enable or disable automatic dark mode. If not specified, any
    /// existing override will be cleared.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
}

impl crate::typed::Command for SetAutoDarkModeOverrideParams {
    const METHOD: &'static str = "Emulation.setAutoDarkModeOverride";
    type Returns = crate::typed::NoReturns;
}

/// Enables CPU throttling to emulate slow CPUs.
///
/// Parameters of `Emulation.setCPUThrottlingRate`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetCpuThrottlingRateParams {
    /// Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown,
    /// etc).
    pub rate: f64,
}

impl crate::typed::Command for SetCpuThrottlingRateParams {
    const METHOD: &'static str = "Emulation.setCPUThrottlingRate";
    type Returns = crate::typed::NoReturns;
}

/// Sets or clears an override of the default background color of the frame.
/// This override is used if the content does not specify one.
///
/// Parameters of `Emulation.setDefaultBackgroundColorOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetDefaultBackgroundColorOverrideParams {
    /// RGBA of the default background color. If not specified, any existing
    /// override will be cleared.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub color: Option<crate::protocol::dom::Rgba>,
}

impl crate::typed::Command for SetDefaultBackgroundColorOverrideParams {
    const METHOD: &'static str = "Emulation.setDefaultBackgroundColorOverride";
    type Returns = crate::typed::NoReturns;
}

/// Overrides the values for env(safe-area-inset-*) and
/// env(safe-area-max-inset-*). Unset values will cause the respective
/// variables to be undefined, even if previously overridden.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setSafeAreaInsetsOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetSafeAreaInsetsOverrideParams {
    pub insets: SafeAreaInsets,
}

impl crate::typed::Command for SetSafeAreaInsetsOverrideParams {
    const METHOD: &'static str = "Emulation.setSafeAreaInsetsOverride";
    type Returns = crate::typed::NoReturns;
}

/// Overrides virtual keyboard geometry in CSS pixels, relative to the
/// top-level viewport. The provided rect is used for
/// navigator.virtualKeyboard.boundingRect, geometrychange events, and
/// env(keyboard-inset-*) values on the inspected frame. The override applies
/// independently of navigator.virtualKeyboard.overlaysContent so clients can
/// preview overlay geometry without mutating page state. Values are rounded
/// to the nearest CSS pixel. Omitting the rect clears the override.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setVirtualKeyboardGeometryOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetVirtualKeyboardGeometryOverrideParams {
    #[serde(
        rename = "keyboardRect",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub keyboard_rect: Option<crate::protocol::dom::Rect>,
}

impl crate::typed::Command for SetVirtualKeyboardGeometryOverrideParams {
    const METHOD: &'static str = "Emulation.setVirtualKeyboardGeometryOverride";
    type Returns = crate::typed::NoReturns;
}

/// Overrides the values of device screen dimensions (window.screen.width,
/// window.screen.height, window.innerWidth, window.innerHeight, and
/// "device-width"/"device-height"-related CSS media query results).
///
/// Parameters of `Emulation.setDeviceMetricsOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetDeviceMetricsOverrideParams {
    /// Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables
    /// the override.
    pub width: i64,
    /// Overriding height value in pixels (minimum 0, maximum 10000000). 0
    /// disables the override.
    pub height: i64,
    /// Overriding device scale factor value. 0 disables the override.
    #[serde(rename = "deviceScaleFactor")]
    pub device_scale_factor: f64,
    /// Whether to emulate mobile device. This includes viewport meta tag, overlay
    /// scrollbars, text autosizing and more.
    pub mobile: bool,
    /// Scale to apply to resulting view image.
    ///
    /// Experimental: may change without notice.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub scale: Option<f64>,
    /// Overriding screen width value in pixels (minimum 0, maximum 10000000).
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "screenWidth",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub screen_width: Option<i64>,
    /// Overriding screen height value in pixels (minimum 0, maximum 10000000).
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "screenHeight",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub screen_height: Option<i64>,
    /// Overriding view X position on screen in pixels (minimum 0, maximum
    /// 10000000).
    ///
    /// Experimental: may change without notice.
    #[serde(rename = "positionX", default, skip_serializing_if = "Option::is_none")]
    pub position_x: Option<i64>,
    /// Overriding view Y position on screen in pixels (minimum 0, maximum
    /// 10000000).
    ///
    /// Experimental: may change without notice.
    #[serde(rename = "positionY", default, skip_serializing_if = "Option::is_none")]
    pub position_y: Option<i64>,
    /// Do not set visible view size, rely upon explicit setVisibleSize call.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "dontSetVisibleSize",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub dont_set_visible_size: Option<bool>,
    /// Screen orientation override.
    #[serde(
        rename = "screenOrientation",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub screen_orientation: Option<ScreenOrientation>,
    /// If set, the visible area of the page will be overridden to this viewport.
    /// This viewport change is not observed by the page, e.g. viewport-relative
    /// elements do not change positions.
    ///
    /// Experimental: may change without notice.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub viewport: Option<crate::protocol::page::Viewport>,
    /// If set, the display feature of a multi-segment screen. If not set,
    /// multi-segment support is turned-off. Deprecated, use
    /// Emulation.setDisplayFeaturesOverride.
    ///
    /// Deprecated in the protocol.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "displayFeature",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub display_feature: Option<DisplayFeature>,
    /// If set, the posture of a foldable device. If not set the posture is set to
    /// continuous. Deprecated, use Emulation.setDevicePostureOverride.
    ///
    /// Deprecated in the protocol.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "devicePosture",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub device_posture: Option<DevicePosture>,
    /// Scrollbar type. Default: `default`.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "scrollbarType",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub scrollbar_type: Option<SetDeviceMetricsOverrideScrollbarType>,
    /// If set to true, enables screen orientation lock emulation, which
    /// intercepts screen.orientation.lock() calls from the page and reports
    /// orientation changes via screenOrientationLockChanged events. This is
    /// useful for emulating mobile device orientation lock behavior in responsive
    /// design mode.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "screenOrientationLockEmulation",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub screen_orientation_lock_emulation: Option<bool>,
    /// Viewport meta tag behavior. Default: `default`. Note: if `mobile` is
    /// `true`, the viewport meta tag is always enabled.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "viewportMeta",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub viewport_meta: Option<SetDeviceMetricsOverrideViewportMeta>,
    /// Text layout mode. Default: `default`. Note: if `mobile` is `true`, mobile
    /// text layout mode (text autosizing) is always enabled.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "textLayoutMode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub text_layout_mode: Option<SetDeviceMetricsOverrideTextLayoutMode>,
}

/// The values `scrollbarType` accepts on `setDeviceMetricsOverride`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetDeviceMetricsOverrideScrollbarType {
    /// `overlay`
    #[serde(rename = "overlay")]
    Overlay,
    /// `default`
    #[serde(rename = "default")]
    Default,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// The values `viewportMeta` accepts on `setDeviceMetricsOverride`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetDeviceMetricsOverrideViewportMeta {
    /// `enable`
    #[serde(rename = "enable")]
    Enable,
    /// `default`
    #[serde(rename = "default")]
    Default,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// The values `textLayoutMode` accepts on `setDeviceMetricsOverride`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetDeviceMetricsOverrideTextLayoutMode {
    /// `mobile`
    #[serde(rename = "mobile")]
    Mobile,
    /// `default`
    #[serde(rename = "default")]
    Default,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

impl crate::typed::Command for SetDeviceMetricsOverrideParams {
    const METHOD: &'static str = "Emulation.setDeviceMetricsOverride";
    type Returns = crate::typed::NoReturns;
}

/// Start reporting the given posture value to the Device Posture API. This
/// override can also be set in setDeviceMetricsOverride().
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setDevicePostureOverride`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetDevicePostureOverrideParams {
    pub posture: DevicePosture,
}

impl crate::typed::Command for SetDevicePostureOverrideParams {
    const METHOD: &'static str = "Emulation.setDevicePostureOverride";
    type Returns = crate::typed::NoReturns;
}

/// Clears a device posture override set with either
/// setDeviceMetricsOverride() or setDevicePostureOverride() and starts using
/// posture information from the platform again. Does nothing if no override
/// is set.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.clearDevicePostureOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearDevicePostureOverrideParams {}

impl crate::typed::Command for ClearDevicePostureOverrideParams {
    const METHOD: &'static str = "Emulation.clearDevicePostureOverride";
    type Returns = crate::typed::NoReturns;
}

/// Start using the given display features to pupulate the Viewport Segments
/// API. This override can also be set in setDeviceMetricsOverride().
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setDisplayFeaturesOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetDisplayFeaturesOverrideParams {
    pub features: Vec<DisplayFeature>,
}

impl crate::typed::Command for SetDisplayFeaturesOverrideParams {
    const METHOD: &'static str = "Emulation.setDisplayFeaturesOverride";
    type Returns = crate::typed::NoReturns;
}

/// Clears the display features override set with either
/// setDeviceMetricsOverride() or setDisplayFeaturesOverride() and starts
/// using display features from the platform again. Does nothing if no
/// override is set.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.clearDisplayFeaturesOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearDisplayFeaturesOverrideParams {}

impl crate::typed::Command for ClearDisplayFeaturesOverrideParams {
    const METHOD: &'static str = "Emulation.clearDisplayFeaturesOverride";
    type Returns = crate::typed::NoReturns;
}

/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setScrollbarsHidden`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetScrollbarsHiddenParams {
    /// Whether scrollbars should be always hidden.
    pub hidden: bool,
}

impl crate::typed::Command for SetScrollbarsHiddenParams {
    const METHOD: &'static str = "Emulation.setScrollbarsHidden";
    type Returns = crate::typed::NoReturns;
}

/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setDocumentCookieDisabled`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetDocumentCookieDisabledParams {
    /// Whether document.coookie API should be disabled.
    pub disabled: bool,
}

impl crate::typed::Command for SetDocumentCookieDisabledParams {
    const METHOD: &'static str = "Emulation.setDocumentCookieDisabled";
    type Returns = crate::typed::NoReturns;
}

/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setEmitTouchEventsForMouse`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetEmitTouchEventsForMouseParams {
    /// Whether touch emulation based on mouse input should be enabled.
    pub enabled: bool,
    /// Touch/gesture events configuration. Default: current platform.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub configuration: Option<SetEmitTouchEventsForMouseConfiguration>,
}

/// The values `configuration` accepts on `setEmitTouchEventsForMouse`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetEmitTouchEventsForMouseConfiguration {
    /// `mobile`
    #[serde(rename = "mobile")]
    Mobile,
    /// `desktop`
    #[serde(rename = "desktop")]
    Desktop,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

impl crate::typed::Command for SetEmitTouchEventsForMouseParams {
    const METHOD: &'static str = "Emulation.setEmitTouchEventsForMouse";
    type Returns = crate::typed::NoReturns;
}

/// Emulates the given media type or media feature for CSS media queries.
///
/// Parameters of `Emulation.setEmulatedMedia`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetEmulatedMediaParams {
    /// Media type to emulate. Empty string disables the override.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub media: Option<String>,
    /// Media features to emulate.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub features: Option<Vec<MediaFeature>>,
}

impl crate::typed::Command for SetEmulatedMediaParams {
    const METHOD: &'static str = "Emulation.setEmulatedMedia";
    type Returns = crate::typed::NoReturns;
}

/// Emulates the given vision deficiency.
///
/// Parameters of `Emulation.setEmulatedVisionDeficiency`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetEmulatedVisionDeficiencyParams {
    /// Vision deficiency to emulate. Order: best-effort emulations come first,
    /// followed by any physiologically accurate emulations for medically
    /// recognized color vision deficiencies.
    pub r#type: SetEmulatedVisionDeficiencyType,
}

/// The values `type` accepts on `setEmulatedVisionDeficiency`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetEmulatedVisionDeficiencyType {
    /// `none`
    #[serde(rename = "none")]
    None,
    /// `blurredVision`
    #[serde(rename = "blurredVision")]
    BlurredVision,
    /// `reducedContrast`
    #[serde(rename = "reducedContrast")]
    ReducedContrast,
    /// `achromatopsia`
    #[serde(rename = "achromatopsia")]
    Achromatopsia,
    /// `deuteranopia`
    #[serde(rename = "deuteranopia")]
    Deuteranopia,
    /// `protanopia`
    #[serde(rename = "protanopia")]
    Protanopia,
    /// `tritanopia`
    #[serde(rename = "tritanopia")]
    Tritanopia,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

impl crate::typed::Command for SetEmulatedVisionDeficiencyParams {
    const METHOD: &'static str = "Emulation.setEmulatedVisionDeficiency";
    type Returns = crate::typed::NoReturns;
}

/// Emulates the given OS text scale.
///
/// Parameters of `Emulation.setEmulatedOSTextScale`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetEmulatedOsTextScaleParams {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub scale: Option<f64>,
}

impl crate::typed::Command for SetEmulatedOsTextScaleParams {
    const METHOD: &'static str = "Emulation.setEmulatedOSTextScale";
    type Returns = crate::typed::NoReturns;
}

/// Overrides the Geolocation Position or Error. Omitting latitude, longitude
/// or accuracy emulates position unavailable.
///
/// Parameters of `Emulation.setGeolocationOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetGeolocationOverrideParams {
    /// Mock latitude
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub latitude: Option<f64>,
    /// Mock longitude
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub longitude: Option<f64>,
    /// Mock accuracy
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub accuracy: Option<f64>,
    /// Mock altitude
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub altitude: Option<f64>,
    /// Mock altitudeAccuracy
    #[serde(
        rename = "altitudeAccuracy",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub altitude_accuracy: Option<f64>,
    /// Mock heading
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub heading: Option<f64>,
    /// Mock speed
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub speed: Option<f64>,
}

impl crate::typed::Command for SetGeolocationOverrideParams {
    const METHOD: &'static str = "Emulation.setGeolocationOverride";
    type Returns = crate::typed::NoReturns;
}

/// Experimental: may change without notice.
///
/// Parameters of `Emulation.getOverriddenSensorInformation`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct GetOverriddenSensorInformationParams {
    pub r#type: SensorType,
}

/// What `Emulation.getOverriddenSensorInformation` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetOverriddenSensorInformationReturns {
    #[serde(rename = "requestedSamplingFrequency")]
    pub requested_sampling_frequency: f64,
}

impl crate::typed::Command for GetOverriddenSensorInformationParams {
    const METHOD: &'static str = "Emulation.getOverriddenSensorInformation";
    type Returns = GetOverriddenSensorInformationReturns;
}

/// Overrides a platform sensor of a given type. If |enabled| is true, calls
/// to Sensor.start() will use a virtual sensor as backend rather than
/// fetching data from a real hardware sensor. Otherwise, existing virtual
/// sensor-backend Sensor objects will fire an error event and new calls to
/// Sensor.start() will attempt to use a real sensor instead.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setSensorOverrideEnabled`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetSensorOverrideEnabledParams {
    pub enabled: bool,
    pub r#type: SensorType,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub metadata: Option<SensorMetadata>,
}

impl crate::typed::Command for SetSensorOverrideEnabledParams {
    const METHOD: &'static str = "Emulation.setSensorOverrideEnabled";
    type Returns = crate::typed::NoReturns;
}

/// Updates the sensor readings reported by a sensor type previously
/// overridden by setSensorOverrideEnabled.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setSensorOverrideReadings`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetSensorOverrideReadingsParams {
    pub r#type: SensorType,
    pub reading: SensorReading,
}

impl crate::typed::Command for SetSensorOverrideReadingsParams {
    const METHOD: &'static str = "Emulation.setSensorOverrideReadings";
    type Returns = crate::typed::NoReturns;
}

/// Overrides a pressure source of a given type, as used by the Compute
/// Pressure API, so that updates to PressureObserver.observe() are provided
/// via setPressureStateOverride instead of being retrieved from
/// platform-provided telemetry data.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setPressureSourceOverrideEnabled`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetPressureSourceOverrideEnabledParams {
    pub enabled: bool,
    pub source: PressureSource,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub metadata: Option<PressureMetadata>,
}

impl crate::typed::Command for SetPressureSourceOverrideEnabledParams {
    const METHOD: &'static str = "Emulation.setPressureSourceOverrideEnabled";
    type Returns = crate::typed::NoReturns;
}

/// Provides a given pressure state that will be processed and eventually be
/// delivered to PressureObserver users. |source| must have been previously
/// overridden by setPressureSourceOverrideEnabled.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setPressureStateOverride`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetPressureStateOverrideParams {
    pub source: PressureSource,
    pub state: PressureState,
}

impl crate::typed::Command for SetPressureStateOverrideParams {
    const METHOD: &'static str = "Emulation.setPressureStateOverride";
    type Returns = crate::typed::NoReturns;
}

/// Overrides the Idle state.
///
/// Parameters of `Emulation.setIdleOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetIdleOverrideParams {
    /// Mock isUserActive
    #[serde(rename = "isUserActive")]
    pub is_user_active: bool,
    /// Mock isScreenUnlocked
    #[serde(rename = "isScreenUnlocked")]
    pub is_screen_unlocked: bool,
}

impl crate::typed::Command for SetIdleOverrideParams {
    const METHOD: &'static str = "Emulation.setIdleOverride";
    type Returns = crate::typed::NoReturns;
}

/// Clears Idle state overrides.
///
/// Parameters of `Emulation.clearIdleOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearIdleOverrideParams {}

impl crate::typed::Command for ClearIdleOverrideParams {
    const METHOD: &'static str = "Emulation.clearIdleOverride";
    type Returns = crate::typed::NoReturns;
}

/// Overrides value returned by the javascript navigator object.
///
/// Deprecated in the protocol.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setNavigatorOverrides`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetNavigatorOverridesParams {
    /// The platform navigator.platform should return.
    pub platform: String,
}

impl crate::typed::Command for SetNavigatorOverridesParams {
    const METHOD: &'static str = "Emulation.setNavigatorOverrides";
    type Returns = crate::typed::NoReturns;
}

/// Sets a specified page scale factor.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setPageScaleFactor`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetPageScaleFactorParams {
    /// Page scale factor.
    #[serde(rename = "pageScaleFactor")]
    pub page_scale_factor: f64,
}

impl crate::typed::Command for SetPageScaleFactorParams {
    const METHOD: &'static str = "Emulation.setPageScaleFactor";
    type Returns = crate::typed::NoReturns;
}

/// Switches script execution in the page.
///
/// Parameters of `Emulation.setScriptExecutionDisabled`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetScriptExecutionDisabledParams {
    /// Whether script execution should be disabled in the page.
    pub value: bool,
}

impl crate::typed::Command for SetScriptExecutionDisabledParams {
    const METHOD: &'static str = "Emulation.setScriptExecutionDisabled";
    type Returns = crate::typed::NoReturns;
}

/// Enables touch on platforms which do not support them.
///
/// Parameters of `Emulation.setTouchEmulationEnabled`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetTouchEmulationEnabledParams {
    /// Whether the touch event emulation should be enabled.
    pub enabled: bool,
    /// Maximum touch points supported. Defaults to one.
    #[serde(
        rename = "maxTouchPoints",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_touch_points: Option<i64>,
}

impl crate::typed::Command for SetTouchEmulationEnabledParams {
    const METHOD: &'static str = "Emulation.setTouchEmulationEnabled";
    type Returns = crate::typed::NoReturns;
}

/// Turns on virtual time for all frames (replacing real-time with a synthetic
/// time source) and sets the current virtual time policy. Note this
/// supersedes any previous time budget.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setVirtualTimePolicy`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetVirtualTimePolicyParams {
    pub policy: VirtualTimePolicy,
    /// If set, after this many virtual milliseconds have elapsed virtual time
    /// will be paused and a virtualTimeBudgetExpired event is sent.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub budget: Option<f64>,
    /// If set this specifies the maximum number of tasks that can be run before
    /// virtual is forced forwards to prevent deadlock.
    #[serde(
        rename = "maxVirtualTimeTaskStarvationCount",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_virtual_time_task_starvation_count: Option<i64>,
    /// If set, base::Time::Now will be overridden to initially return this value.
    #[serde(
        rename = "initialVirtualTime",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub initial_virtual_time: Option<crate::protocol::network::TimeSinceEpoch>,
}

/// What `Emulation.setVirtualTimePolicy` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetVirtualTimePolicyReturns {
    /// Absolute timestamp at which virtual time was first enabled (up time in
    /// milliseconds).
    #[serde(rename = "virtualTimeTicksBase")]
    pub virtual_time_ticks_base: f64,
}

impl crate::typed::Command for SetVirtualTimePolicyParams {
    const METHOD: &'static str = "Emulation.setVirtualTimePolicy";
    type Returns = SetVirtualTimePolicyReturns;
}

/// Overrides default host system locale with the specified one.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setLocaleOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetLocaleOverrideParams {
    /// ICU style C locale (e.g. "en_US"). If not specified or empty, disables the
    /// override and restores default host system locale.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
}

impl crate::typed::Command for SetLocaleOverrideParams {
    const METHOD: &'static str = "Emulation.setLocaleOverride";
    type Returns = crate::typed::NoReturns;
}

/// Overrides default host system timezone with the specified one.
///
/// Parameters of `Emulation.setTimezoneOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetTimezoneOverrideParams {
    /// 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.
    #[serde(rename = "timezoneId")]
    pub timezone_id: String,
}

impl crate::typed::Command for SetTimezoneOverrideParams {
    const METHOD: &'static str = "Emulation.setTimezoneOverride";
    type Returns = crate::typed::NoReturns;
}

/// Resizes the frame/viewport of the page. Note that this does not affect the
/// frame's container (e.g. browser window). Can be used to produce
/// screenshots of the specified size. Not supported on Android.
///
/// Deprecated in the protocol.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setVisibleSize`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetVisibleSizeParams {
    /// Frame width (DIP).
    pub width: i64,
    /// Frame height (DIP).
    pub height: i64,
}

impl crate::typed::Command for SetVisibleSizeParams {
    const METHOD: &'static str = "Emulation.setVisibleSize";
    type Returns = crate::typed::NoReturns;
}

/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setDisabledImageTypes`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetDisabledImageTypesParams {
    /// Image types to disable.
    #[serde(rename = "imageTypes")]
    pub image_types: Vec<DisabledImageType>,
}

impl crate::typed::Command for SetDisabledImageTypesParams {
    const METHOD: &'static str = "Emulation.setDisabledImageTypes";
    type Returns = crate::typed::NoReturns;
}

/// Override the value of navigator.connection.saveData
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setDataSaverOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetDataSaverOverrideParams {
    /// Override value. Omitting the parameter disables the override.
    #[serde(
        rename = "dataSaverEnabled",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub data_saver_enabled: Option<bool>,
}

impl crate::typed::Command for SetDataSaverOverrideParams {
    const METHOD: &'static str = "Emulation.setDataSaverOverride";
    type Returns = crate::typed::NoReturns;
}

/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setHardwareConcurrencyOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetHardwareConcurrencyOverrideParams {
    /// Hardware concurrency to report
    #[serde(rename = "hardwareConcurrency")]
    pub hardware_concurrency: i64,
}

impl crate::typed::Command for SetHardwareConcurrencyOverrideParams {
    const METHOD: &'static str = "Emulation.setHardwareConcurrencyOverride";
    type Returns = crate::typed::NoReturns;
}

/// Overrides the value of navigator.cpuPerformance
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setCPUPerformanceOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetCpuPerformanceOverrideParams {
    /// Override value. Omitting the parameter disables the override.
    #[serde(
        rename = "performanceTier",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub performance_tier: Option<SetCpuPerformanceOverridePerformanceTier>,
}

/// The values `performanceTier` accepts on `setCPUPerformanceOverride`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetCpuPerformanceOverridePerformanceTier {
    /// `unknown`
    #[serde(rename = "unknown")]
    Unknown,
    /// `low`
    #[serde(rename = "low")]
    Low,
    /// `mid`
    #[serde(rename = "mid")]
    Mid,
    /// `high`
    #[serde(rename = "high")]
    High,
    /// `ultra`
    #[serde(rename = "ultra")]
    Ultra,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

impl crate::typed::Command for SetCpuPerformanceOverrideParams {
    const METHOD: &'static str = "Emulation.setCPUPerformanceOverride";
    type Returns = crate::typed::NoReturns;
}

/// Allows overriding user agent with the given string. `userAgentMetadata`
/// must be set for Client Hint headers to be sent.
///
/// Parameters of `Emulation.setUserAgentOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetUserAgentOverrideParams {
    /// User agent to use.
    #[serde(rename = "userAgent")]
    pub user_agent: String,
    /// Browser language to emulate.
    #[serde(
        rename = "acceptLanguage",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub accept_language: Option<String>,
    /// The platform navigator.platform should return.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub platform: Option<String>,
    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "userAgentMetadata",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub user_agent_metadata: Option<UserAgentMetadata>,
}

impl crate::typed::Command for SetUserAgentOverrideParams {
    const METHOD: &'static str = "Emulation.setUserAgentOverride";
    type Returns = crate::typed::NoReturns;
}

/// Allows overriding the automation flag.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setAutomationOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetAutomationOverrideParams {
    /// Whether the override should be enabled.
    pub enabled: bool,
}

impl crate::typed::Command for SetAutomationOverrideParams {
    const METHOD: &'static str = "Emulation.setAutomationOverride";
    type Returns = crate::typed::NoReturns;
}

/// Allows overriding the difference between the small and large viewport
/// sizes, which determine the value of the `svh` and `lvh` unit,
/// respectively. Only supported for top-level frames.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setSmallViewportHeightDifferenceOverride`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetSmallViewportHeightDifferenceOverrideParams {
    /// This will cause an element of size 100svh to be `difference` pixels
    /// smaller than an element of size 100lvh.
    pub difference: i64,
}

impl crate::typed::Command for SetSmallViewportHeightDifferenceOverrideParams {
    const METHOD: &'static str = "Emulation.setSmallViewportHeightDifferenceOverride";
    type Returns = crate::typed::NoReturns;
}

/// Returns device's screen configuration. In headful mode, the physical
/// screens configuration is returned, whereas in headless mode, a virtual
/// headless screen configuration is provided instead.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.getScreenInfos`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetScreenInfosParams {}

/// What `Emulation.getScreenInfos` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetScreenInfosReturns {
    #[serde(rename = "screenInfos")]
    pub screen_infos: Vec<ScreenInfo>,
}

impl crate::typed::Command for GetScreenInfosParams {
    const METHOD: &'static str = "Emulation.getScreenInfos";
    type Returns = GetScreenInfosReturns;
}

/// Add a new screen to the device. Only supported in headless mode.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.addScreen`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddScreenParams {
    /// Offset of the left edge of the screen in pixels.
    pub left: i64,
    /// Offset of the top edge of the screen in pixels.
    pub top: i64,
    /// The width of the screen in pixels.
    pub width: i64,
    /// The height of the screen in pixels.
    pub height: i64,
    /// Specifies the screen's work area. Default is entire screen.
    #[serde(
        rename = "workAreaInsets",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub work_area_insets: Option<WorkAreaInsets>,
    /// Specifies the screen's device pixel ratio. Default is 1.
    #[serde(
        rename = "devicePixelRatio",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub device_pixel_ratio: Option<f64>,
    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and
    /// 270. Default is 0.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub rotation: Option<i64>,
    /// Specifies the screen's color depth in bits. Default is 24.
    #[serde(
        rename = "colorDepth",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub color_depth: Option<i64>,
    /// Specifies the descriptive label for the screen. Default is none.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    /// Indicates whether the screen is internal to the device or external,
    /// attached to the device. Default is false.
    #[serde(
        rename = "isInternal",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_internal: Option<bool>,
}

/// What `Emulation.addScreen` answers with.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AddScreenReturns {
    #[serde(rename = "screenInfo")]
    pub screen_info: ScreenInfo,
}

impl crate::typed::Command for AddScreenParams {
    const METHOD: &'static str = "Emulation.addScreen";
    type Returns = AddScreenReturns;
}

/// Updates specified screen parameters. Only supported in headless mode.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.updateScreen`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct UpdateScreenParams {
    /// Target screen identifier.
    #[serde(rename = "screenId")]
    pub screen_id: ScreenId,
    /// Offset of the left edge of the screen in pixels.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub left: Option<i64>,
    /// Offset of the top edge of the screen in pixels.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub top: Option<i64>,
    /// The width of the screen in pixels.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub width: Option<i64>,
    /// The height of the screen in pixels.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub height: Option<i64>,
    /// Specifies the screen's work area.
    #[serde(
        rename = "workAreaInsets",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub work_area_insets: Option<WorkAreaInsets>,
    /// Specifies the screen's device pixel ratio.
    #[serde(
        rename = "devicePixelRatio",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub device_pixel_ratio: Option<f64>,
    /// Specifies the screen's rotation angle. Available values are 0, 90, 180 and
    /// 270.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub rotation: Option<i64>,
    /// Specifies the screen's color depth in bits.
    #[serde(
        rename = "colorDepth",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub color_depth: Option<i64>,
    /// Specifies the descriptive label for the screen.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    /// Indicates whether the screen is internal to the device or external,
    /// attached to the device. Default is false.
    #[serde(
        rename = "isInternal",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_internal: Option<bool>,
}

/// What `Emulation.updateScreen` answers with.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct UpdateScreenReturns {
    #[serde(rename = "screenInfo")]
    pub screen_info: ScreenInfo,
}

impl crate::typed::Command for UpdateScreenParams {
    const METHOD: &'static str = "Emulation.updateScreen";
    type Returns = UpdateScreenReturns;
}

/// Remove screen from the device. Only supported in headless mode.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.removeScreen`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemoveScreenParams {
    #[serde(rename = "screenId")]
    pub screen_id: ScreenId,
}

impl crate::typed::Command for RemoveScreenParams {
    const METHOD: &'static str = "Emulation.removeScreen";
    type Returns = crate::typed::NoReturns;
}

/// Set primary screen. Only supported in headless mode. Note that this
/// changes the coordinate system origin to the top-left of the new primary
/// screen, updating the bounds and work areas of all existing screens
/// accordingly.
///
/// Experimental: may change without notice.
///
/// Parameters of `Emulation.setPrimaryScreen`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetPrimaryScreenParams {
    #[serde(rename = "screenId")]
    pub screen_id: ScreenId,
}

impl crate::typed::Command for SetPrimaryScreenParams {
    const METHOD: &'static str = "Emulation.setPrimaryScreen";
    type Returns = crate::typed::NoReturns;
}

/// Notification sent after the virtual time budget for the current
/// VirtualTimePolicy has run out.
///
/// Experimental: may change without notice.
///
/// Payload of the `Emulation.virtualTimeBudgetExpired` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct VirtualTimeBudgetExpiredEvent {}

impl crate::typed::Event for VirtualTimeBudgetExpiredEvent {
    const METHOD: &'static str = "Emulation.virtualTimeBudgetExpired";
}

/// Fired when a page calls screen.orientation.lock() or
/// screen.orientation.unlock() while device emulation is enabled. This allows
/// the DevTools frontend to update the emulated device orientation
/// accordingly.
///
/// Experimental: may change without notice.
///
/// Payload of the `Emulation.screenOrientationLockChanged` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ScreenOrientationLockChangedEvent {
    /// Whether the screen orientation is currently locked.
    pub locked: bool,
    /// The orientation lock type requested by the page. Only set when locked is
    /// true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub orientation: Option<ScreenOrientation>,
}

impl crate::typed::Event for ScreenOrientationLockChangedEvent {
    const METHOD: &'static str = "Emulation.screenOrientationLockChanged";
}