browser-protocol 0.1.4

Generated Rust types and commands for the Chrome DevTools Protocol (browser-protocol)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
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
use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
use std::borrow::Cow;


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct TouchPoint {
    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
    x: f64,
    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    y: f64,
    /// X radius of the touch area (default: 1.0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "radiusX")]
    radius_x: Option<f64>,
    /// Y radius of the touch area (default: 1.0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "radiusY")]
    radius_y: Option<f64>,
    /// Rotation angle (default: 0.0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "rotationAngle")]
    rotation_angle: Option<f64>,
    /// Force (default: 1.0).
    #[serde(skip_serializing_if = "Option::is_none")]
    force: Option<f64>,
    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "tangentialPressure")]
    tangential_pressure: Option<f64>,
    /// The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive tiltX is to the right (default: 0)
    #[serde(skip_serializing_if = "Option::is_none", rename = "tiltX")]
    tilt_x: Option<f64>,
    /// The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range \[-90,90\], a positive tiltY is towards the user (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "tiltY")]
    tilt_y: Option<f64>,
    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
    #[serde(skip_serializing_if = "Option::is_none")]
    twist: Option<i64>,
    /// Identifier used to track touch sources between events, must be unique within an event.
    #[serde(skip_serializing_if = "Option::is_none")]
    id: Option<f64>,
}

impl TouchPoint {
    /// Creates a builder for this type with the required parameters:
    /// * `x`: X coordinate of the event relative to the main frame's viewport in CSS pixels.
    /// * `y`: Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    pub fn builder(x: f64, y: f64) -> TouchPointBuilder {
        TouchPointBuilder {
            x: x,
            y: y,
            radius_x: None,
            radius_y: None,
            rotation_angle: None,
            force: None,
            tangential_pressure: None,
            tilt_x: None,
            tilt_y: None,
            twist: None,
            id: None,
        }
    }
    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
    pub fn x(&self) -> f64 { self.x }
    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    pub fn y(&self) -> f64 { self.y }
    /// X radius of the touch area (default: 1.0).
    pub fn radius_x(&self) -> Option<f64> { self.radius_x }
    /// Y radius of the touch area (default: 1.0).
    pub fn radius_y(&self) -> Option<f64> { self.radius_y }
    /// Rotation angle (default: 0.0).
    pub fn rotation_angle(&self) -> Option<f64> { self.rotation_angle }
    /// Force (default: 1.0).
    pub fn force(&self) -> Option<f64> { self.force }
    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
    pub fn tangential_pressure(&self) -> Option<f64> { self.tangential_pressure }
    /// The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive tiltX is to the right (default: 0)
    pub fn tilt_x(&self) -> Option<f64> { self.tilt_x }
    /// The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range \[-90,90\], a positive tiltY is towards the user (default: 0).
    pub fn tilt_y(&self) -> Option<f64> { self.tilt_y }
    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
    pub fn twist(&self) -> Option<i64> { self.twist }
    /// Identifier used to track touch sources between events, must be unique within an event.
    pub fn id(&self) -> Option<f64> { self.id }
}


pub struct TouchPointBuilder {
    x: f64,
    y: f64,
    radius_x: Option<f64>,
    radius_y: Option<f64>,
    rotation_angle: Option<f64>,
    force: Option<f64>,
    tangential_pressure: Option<f64>,
    tilt_x: Option<f64>,
    tilt_y: Option<f64>,
    twist: Option<i64>,
    id: Option<f64>,
}

impl TouchPointBuilder {
    /// X radius of the touch area (default: 1.0).
    pub fn radius_x(mut self, radius_x: f64) -> Self { self.radius_x = Some(radius_x); self }
    /// Y radius of the touch area (default: 1.0).
    pub fn radius_y(mut self, radius_y: f64) -> Self { self.radius_y = Some(radius_y); self }
    /// Rotation angle (default: 0.0).
    pub fn rotation_angle(mut self, rotation_angle: f64) -> Self { self.rotation_angle = Some(rotation_angle); self }
    /// Force (default: 1.0).
    pub fn force(mut self, force: f64) -> Self { self.force = Some(force); self }
    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
    pub fn tangential_pressure(mut self, tangential_pressure: f64) -> Self { self.tangential_pressure = Some(tangential_pressure); self }
    /// The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive tiltX is to the right (default: 0)
    pub fn tilt_x(mut self, tilt_x: f64) -> Self { self.tilt_x = Some(tilt_x); self }
    /// The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range \[-90,90\], a positive tiltY is towards the user (default: 0).
    pub fn tilt_y(mut self, tilt_y: f64) -> Self { self.tilt_y = Some(tilt_y); self }
    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
    pub fn twist(mut self, twist: i64) -> Self { self.twist = Some(twist); self }
    /// Identifier used to track touch sources between events, must be unique within an event.
    pub fn id(mut self, id: f64) -> Self { self.id = Some(id); self }
    pub fn build(self) -> TouchPoint {
        TouchPoint {
            x: self.x,
            y: self.y,
            radius_x: self.radius_x,
            radius_y: self.radius_y,
            rotation_angle: self.rotation_angle,
            force: self.force,
            tangential_pressure: self.tangential_pressure,
            tilt_x: self.tilt_x,
            tilt_y: self.tilt_y,
            twist: self.twist,
            id: self.id,
        }
    }
}


#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum GestureSourceType {
    #[default]
    #[serde(rename = "default")]
    Default,
    #[serde(rename = "touch")]
    Touch,
    #[serde(rename = "mouse")]
    Mouse,
}


#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum MouseButton {
    #[default]
    #[serde(rename = "none")]
    None,
    #[serde(rename = "left")]
    Left,
    #[serde(rename = "middle")]
    Middle,
    #[serde(rename = "right")]
    Right,
    #[serde(rename = "back")]
    Back,
    #[serde(rename = "forward")]
    Forward,
}

/// UTC time in seconds, counted from January 1, 1970.

pub type TimeSinceEpoch = f64;


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DragDataItem<'a> {
    /// Mime type of the dragged data.
    #[serde(rename = "mimeType")]
    mime_type: Cow<'a, str>,
    /// Depending of the value of 'mimeType', it contains the dragged link,
    /// text, HTML markup or any other data.
    data: Cow<'a, str>,
    /// Title associated with a link. Only valid when 'mimeType' == "text/uri-list".
    #[serde(skip_serializing_if = "Option::is_none")]
    title: Option<Cow<'a, str>>,
    /// Stores the base URL for the contained markup. Only valid when 'mimeType'
    /// == "text/html".
    #[serde(skip_serializing_if = "Option::is_none", rename = "baseURL")]
    base_url: Option<Cow<'a, str>>,
}

impl<'a> DragDataItem<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `mime_type`: Mime type of the dragged data.
    /// * `data`: Depending of the value of `mimeType`, it contains the dragged link, text, HTML markup or any other data.
    pub fn builder(mime_type: impl Into<Cow<'a, str>>, data: impl Into<Cow<'a, str>>) -> DragDataItemBuilder<'a> {
        DragDataItemBuilder {
            mime_type: mime_type.into(),
            data: data.into(),
            title: None,
            base_url: None,
        }
    }
    /// Mime type of the dragged data.
    pub fn mime_type(&self) -> &str { self.mime_type.as_ref() }
    /// Depending of the value of 'mimeType', it contains the dragged link,
    /// text, HTML markup or any other data.
    pub fn data(&self) -> &str { self.data.as_ref() }
    /// Title associated with a link. Only valid when 'mimeType' == "text/uri-list".
    pub fn title(&self) -> Option<&str> { self.title.as_deref() }
    /// Stores the base URL for the contained markup. Only valid when 'mimeType'
    /// == "text/html".
    pub fn base_url(&self) -> Option<&str> { self.base_url.as_deref() }
}


pub struct DragDataItemBuilder<'a> {
    mime_type: Cow<'a, str>,
    data: Cow<'a, str>,
    title: Option<Cow<'a, str>>,
    base_url: Option<Cow<'a, str>>,
}

impl<'a> DragDataItemBuilder<'a> {
    /// Title associated with a link. Only valid when 'mimeType' == "text/uri-list".
    pub fn title(mut self, title: impl Into<Cow<'a, str>>) -> Self { self.title = Some(title.into()); self }
    /// Stores the base URL for the contained markup. Only valid when 'mimeType'
    /// == "text/html".
    pub fn base_url(mut self, base_url: impl Into<Cow<'a, str>>) -> Self { self.base_url = Some(base_url.into()); self }
    pub fn build(self) -> DragDataItem<'a> {
        DragDataItem {
            mime_type: self.mime_type,
            data: self.data,
            title: self.title,
            base_url: self.base_url,
        }
    }
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DragData<'a> {
    items: Vec<DragDataItem<'a>>,
    /// List of filenames that should be included when dropping
    #[serde(skip_serializing_if = "Option::is_none")]
    files: Option<Vec<Cow<'a, str>>>,
    /// Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16
    #[serde(rename = "dragOperationsMask")]
    drag_operations_mask: i64,
}

impl<'a> DragData<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `items`: 
    /// * `drag_operations_mask`: Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16
    pub fn builder(items: Vec<DragDataItem<'a>>, drag_operations_mask: i64) -> DragDataBuilder<'a> {
        DragDataBuilder {
            items: items,
            files: None,
            drag_operations_mask: drag_operations_mask,
        }
    }
    pub fn items(&self) -> &[DragDataItem<'a>] { &self.items }
    /// List of filenames that should be included when dropping
    pub fn files(&self) -> Option<&[Cow<'a, str>]> { self.files.as_deref() }
    /// Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16
    pub fn drag_operations_mask(&self) -> i64 { self.drag_operations_mask }
}


pub struct DragDataBuilder<'a> {
    items: Vec<DragDataItem<'a>>,
    files: Option<Vec<Cow<'a, str>>>,
    drag_operations_mask: i64,
}

impl<'a> DragDataBuilder<'a> {
    /// List of filenames that should be included when dropping
    pub fn files(mut self, files: Vec<Cow<'a, str>>) -> Self { self.files = Some(files); self }
    pub fn build(self) -> DragData<'a> {
        DragData {
            items: self.items,
            files: self.files,
            drag_operations_mask: self.drag_operations_mask,
        }
    }
}

/// Dispatches a drag event into the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchDragEventParams<'a> {
    /// Type of the drag event.
    #[serde(rename = "type")]
    type_: Cow<'a, str>,
    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
    x: f64,
    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    y: f64,
    data: DragData<'a>,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    #[serde(skip_serializing_if = "Option::is_none")]
    modifiers: Option<i64>,
}

impl<'a> DispatchDragEventParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `type_`: Type of the drag event.
    /// * `x`: X coordinate of the event relative to the main frame's viewport in CSS pixels.
    /// * `y`: Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    /// * `data`: 
    pub fn builder(type_: impl Into<Cow<'a, str>>, x: f64, y: f64, data: DragData<'a>) -> DispatchDragEventParamsBuilder<'a> {
        DispatchDragEventParamsBuilder {
            type_: type_.into(),
            x: x,
            y: y,
            data: data,
            modifiers: None,
        }
    }
    /// Type of the drag event.
    pub fn type_(&self) -> &str { self.type_.as_ref() }
    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
    pub fn x(&self) -> f64 { self.x }
    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    pub fn y(&self) -> f64 { self.y }
    pub fn data(&self) -> &DragData<'a> { &self.data }
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
}


pub struct DispatchDragEventParamsBuilder<'a> {
    type_: Cow<'a, str>,
    x: f64,
    y: f64,
    data: DragData<'a>,
    modifiers: Option<i64>,
}

impl<'a> DispatchDragEventParamsBuilder<'a> {
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
    pub fn build(self) -> DispatchDragEventParams<'a> {
        DispatchDragEventParams {
            type_: self.type_,
            x: self.x,
            y: self.y,
            data: self.data,
            modifiers: self.modifiers,
        }
    }
}

impl<'a> DispatchDragEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchDragEvent"; }

impl<'a> crate::CdpCommand<'a> for DispatchDragEventParams<'a> {
    const METHOD: &'static str = "Input.dispatchDragEvent";
    type Response = crate::EmptyReturns;
}

/// Dispatches a key event to the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchKeyEventParams<'a> {
    /// Type of the key event.
    #[serde(rename = "type")]
    type_: Cow<'a, str>,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    #[serde(skip_serializing_if = "Option::is_none")]
    modifiers: Option<i64>,
    /// Time at which the event occurred.
    #[serde(skip_serializing_if = "Option::is_none")]
    timestamp: Option<TimeSinceEpoch>,
    /// Text as generated by processing a virtual key code with a keyboard layout. Not needed for
    /// for 'keyUp' and 'rawKeyDown' events (default: "")
    #[serde(skip_serializing_if = "Option::is_none")]
    text: Option<Cow<'a, str>>,
    /// Text that would have been generated by the keyboard if no modifiers were pressed (except for
    /// shift). Useful for shortcut (accelerator) key handling (default: "").
    #[serde(skip_serializing_if = "Option::is_none", rename = "unmodifiedText")]
    unmodified_text: Option<Cow<'a, str>>,
    /// Unique key identifier (e.g., 'U+0041') (default: "").
    #[serde(skip_serializing_if = "Option::is_none", rename = "keyIdentifier")]
    key_identifier: Option<Cow<'a, str>>,
    /// Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
    #[serde(skip_serializing_if = "Option::is_none")]
    code: Option<Cow<'a, str>>,
    /// Unique DOM defined string value describing the meaning of the key in the context of active
    /// modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
    #[serde(skip_serializing_if = "Option::is_none")]
    key: Option<Cow<'a, str>>,
    /// Windows virtual key code (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "windowsVirtualKeyCode")]
    windows_virtual_key_code: Option<i64>,
    /// Native virtual key code (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "nativeVirtualKeyCode")]
    native_virtual_key_code: Option<i64>,
    /// Whether the event was generated from auto repeat (default: false).
    #[serde(skip_serializing_if = "Option::is_none", rename = "autoRepeat")]
    auto_repeat: Option<bool>,
    /// Whether the event was generated from the keypad (default: false).
    #[serde(skip_serializing_if = "Option::is_none", rename = "isKeypad")]
    is_keypad: Option<bool>,
    /// Whether the event was a system key event (default: false).
    #[serde(skip_serializing_if = "Option::is_none", rename = "isSystemKey")]
    is_system_key: Option<bool>,
    /// Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:
    /// 0).
    #[serde(skip_serializing_if = "Option::is_none")]
    location: Option<i64>,
    /// Editing commands to send with the key event (e.g., 'selectAll') (default: \[\]).
    /// These are related to but not equal the command names used in 'document.execCommand' and NSStandardKeyBindingResponding.
    /// See <https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h> for valid command names.
    #[serde(skip_serializing_if = "Option::is_none")]
    commands: Option<Vec<Cow<'a, str>>>,
}

impl<'a> DispatchKeyEventParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `type_`: Type of the key event.
    pub fn builder(type_: impl Into<Cow<'a, str>>) -> DispatchKeyEventParamsBuilder<'a> {
        DispatchKeyEventParamsBuilder {
            type_: type_.into(),
            modifiers: None,
            timestamp: None,
            text: None,
            unmodified_text: None,
            key_identifier: None,
            code: None,
            key: None,
            windows_virtual_key_code: None,
            native_virtual_key_code: None,
            auto_repeat: None,
            is_keypad: None,
            is_system_key: None,
            location: None,
            commands: None,
        }
    }
    /// Type of the key event.
    pub fn type_(&self) -> &str { self.type_.as_ref() }
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
    /// Time at which the event occurred.
    pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
    /// Text as generated by processing a virtual key code with a keyboard layout. Not needed for
    /// for 'keyUp' and 'rawKeyDown' events (default: "")
    pub fn text(&self) -> Option<&str> { self.text.as_deref() }
    /// Text that would have been generated by the keyboard if no modifiers were pressed (except for
    /// shift). Useful for shortcut (accelerator) key handling (default: "").
    pub fn unmodified_text(&self) -> Option<&str> { self.unmodified_text.as_deref() }
    /// Unique key identifier (e.g., 'U+0041') (default: "").
    pub fn key_identifier(&self) -> Option<&str> { self.key_identifier.as_deref() }
    /// Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
    pub fn code(&self) -> Option<&str> { self.code.as_deref() }
    /// Unique DOM defined string value describing the meaning of the key in the context of active
    /// modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
    pub fn key(&self) -> Option<&str> { self.key.as_deref() }
    /// Windows virtual key code (default: 0).
    pub fn windows_virtual_key_code(&self) -> Option<i64> { self.windows_virtual_key_code }
    /// Native virtual key code (default: 0).
    pub fn native_virtual_key_code(&self) -> Option<i64> { self.native_virtual_key_code }
    /// Whether the event was generated from auto repeat (default: false).
    pub fn auto_repeat(&self) -> Option<bool> { self.auto_repeat }
    /// Whether the event was generated from the keypad (default: false).
    pub fn is_keypad(&self) -> Option<bool> { self.is_keypad }
    /// Whether the event was a system key event (default: false).
    pub fn is_system_key(&self) -> Option<bool> { self.is_system_key }
    /// Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:
    /// 0).
    pub fn location(&self) -> Option<i64> { self.location }
    /// Editing commands to send with the key event (e.g., 'selectAll') (default: \[\]).
    /// These are related to but not equal the command names used in 'document.execCommand' and NSStandardKeyBindingResponding.
    /// See <https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h> for valid command names.
    pub fn commands(&self) -> Option<&[Cow<'a, str>]> { self.commands.as_deref() }
}


pub struct DispatchKeyEventParamsBuilder<'a> {
    type_: Cow<'a, str>,
    modifiers: Option<i64>,
    timestamp: Option<TimeSinceEpoch>,
    text: Option<Cow<'a, str>>,
    unmodified_text: Option<Cow<'a, str>>,
    key_identifier: Option<Cow<'a, str>>,
    code: Option<Cow<'a, str>>,
    key: Option<Cow<'a, str>>,
    windows_virtual_key_code: Option<i64>,
    native_virtual_key_code: Option<i64>,
    auto_repeat: Option<bool>,
    is_keypad: Option<bool>,
    is_system_key: Option<bool>,
    location: Option<i64>,
    commands: Option<Vec<Cow<'a, str>>>,
}

impl<'a> DispatchKeyEventParamsBuilder<'a> {
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
    /// Time at which the event occurred.
    pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
    /// Text as generated by processing a virtual key code with a keyboard layout. Not needed for
    /// for 'keyUp' and 'rawKeyDown' events (default: "")
    pub fn text(mut self, text: impl Into<Cow<'a, str>>) -> Self { self.text = Some(text.into()); self }
    /// Text that would have been generated by the keyboard if no modifiers were pressed (except for
    /// shift). Useful for shortcut (accelerator) key handling (default: "").
    pub fn unmodified_text(mut self, unmodified_text: impl Into<Cow<'a, str>>) -> Self { self.unmodified_text = Some(unmodified_text.into()); self }
    /// Unique key identifier (e.g., 'U+0041') (default: "").
    pub fn key_identifier(mut self, key_identifier: impl Into<Cow<'a, str>>) -> Self { self.key_identifier = Some(key_identifier.into()); self }
    /// Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
    pub fn code(mut self, code: impl Into<Cow<'a, str>>) -> Self { self.code = Some(code.into()); self }
    /// Unique DOM defined string value describing the meaning of the key in the context of active
    /// modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
    pub fn key(mut self, key: impl Into<Cow<'a, str>>) -> Self { self.key = Some(key.into()); self }
    /// Windows virtual key code (default: 0).
    pub fn windows_virtual_key_code(mut self, windows_virtual_key_code: i64) -> Self { self.windows_virtual_key_code = Some(windows_virtual_key_code); self }
    /// Native virtual key code (default: 0).
    pub fn native_virtual_key_code(mut self, native_virtual_key_code: i64) -> Self { self.native_virtual_key_code = Some(native_virtual_key_code); self }
    /// Whether the event was generated from auto repeat (default: false).
    pub fn auto_repeat(mut self, auto_repeat: bool) -> Self { self.auto_repeat = Some(auto_repeat); self }
    /// Whether the event was generated from the keypad (default: false).
    pub fn is_keypad(mut self, is_keypad: bool) -> Self { self.is_keypad = Some(is_keypad); self }
    /// Whether the event was a system key event (default: false).
    pub fn is_system_key(mut self, is_system_key: bool) -> Self { self.is_system_key = Some(is_system_key); self }
    /// Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:
    /// 0).
    pub fn location(mut self, location: i64) -> Self { self.location = Some(location); self }
    /// Editing commands to send with the key event (e.g., 'selectAll') (default: \[\]).
    /// These are related to but not equal the command names used in 'document.execCommand' and NSStandardKeyBindingResponding.
    /// See <https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h> for valid command names.
    pub fn commands(mut self, commands: Vec<Cow<'a, str>>) -> Self { self.commands = Some(commands); self }
    pub fn build(self) -> DispatchKeyEventParams<'a> {
        DispatchKeyEventParams {
            type_: self.type_,
            modifiers: self.modifiers,
            timestamp: self.timestamp,
            text: self.text,
            unmodified_text: self.unmodified_text,
            key_identifier: self.key_identifier,
            code: self.code,
            key: self.key,
            windows_virtual_key_code: self.windows_virtual_key_code,
            native_virtual_key_code: self.native_virtual_key_code,
            auto_repeat: self.auto_repeat,
            is_keypad: self.is_keypad,
            is_system_key: self.is_system_key,
            location: self.location,
            commands: self.commands,
        }
    }
}

impl<'a> DispatchKeyEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchKeyEvent"; }

impl<'a> crate::CdpCommand<'a> for DispatchKeyEventParams<'a> {
    const METHOD: &'static str = "Input.dispatchKeyEvent";
    type Response = crate::EmptyReturns;
}

/// This method emulates inserting text that doesn't come from a key press,
/// for example an emoji keyboard or an IME.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct InsertTextParams<'a> {
    /// The text to insert.
    text: Cow<'a, str>,
}

impl<'a> InsertTextParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `text`: The text to insert.
    pub fn builder(text: impl Into<Cow<'a, str>>) -> InsertTextParamsBuilder<'a> {
        InsertTextParamsBuilder {
            text: text.into(),
        }
    }
    /// The text to insert.
    pub fn text(&self) -> &str { self.text.as_ref() }
}


pub struct InsertTextParamsBuilder<'a> {
    text: Cow<'a, str>,
}

impl<'a> InsertTextParamsBuilder<'a> {
    pub fn build(self) -> InsertTextParams<'a> {
        InsertTextParams {
            text: self.text,
        }
    }
}

impl<'a> InsertTextParams<'a> { pub const METHOD: &'static str = "Input.insertText"; }

impl<'a> crate::CdpCommand<'a> for InsertTextParams<'a> {
    const METHOD: &'static str = "Input.insertText";
    type Response = crate::EmptyReturns;
}

/// This method sets the current candidate text for IME.
/// Use imeCommitComposition to commit the final text.
/// Use imeSetComposition with empty string as text to cancel composition.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ImeSetCompositionParams<'a> {
    /// The text to insert
    text: Cow<'a, str>,
    /// selection start
    #[serde(rename = "selectionStart")]
    selection_start: i64,
    /// selection end
    #[serde(rename = "selectionEnd")]
    selection_end: i64,
    /// replacement start
    #[serde(skip_serializing_if = "Option::is_none", rename = "replacementStart")]
    replacement_start: Option<i64>,
    /// replacement end
    #[serde(skip_serializing_if = "Option::is_none", rename = "replacementEnd")]
    replacement_end: Option<i64>,
}

impl<'a> ImeSetCompositionParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `text`: The text to insert
    /// * `selection_start`: selection start
    /// * `selection_end`: selection end
    pub fn builder(text: impl Into<Cow<'a, str>>, selection_start: i64, selection_end: i64) -> ImeSetCompositionParamsBuilder<'a> {
        ImeSetCompositionParamsBuilder {
            text: text.into(),
            selection_start: selection_start,
            selection_end: selection_end,
            replacement_start: None,
            replacement_end: None,
        }
    }
    /// The text to insert
    pub fn text(&self) -> &str { self.text.as_ref() }
    /// selection start
    pub fn selection_start(&self) -> i64 { self.selection_start }
    /// selection end
    pub fn selection_end(&self) -> i64 { self.selection_end }
    /// replacement start
    pub fn replacement_start(&self) -> Option<i64> { self.replacement_start }
    /// replacement end
    pub fn replacement_end(&self) -> Option<i64> { self.replacement_end }
}


pub struct ImeSetCompositionParamsBuilder<'a> {
    text: Cow<'a, str>,
    selection_start: i64,
    selection_end: i64,
    replacement_start: Option<i64>,
    replacement_end: Option<i64>,
}

impl<'a> ImeSetCompositionParamsBuilder<'a> {
    /// replacement start
    pub fn replacement_start(mut self, replacement_start: i64) -> Self { self.replacement_start = Some(replacement_start); self }
    /// replacement end
    pub fn replacement_end(mut self, replacement_end: i64) -> Self { self.replacement_end = Some(replacement_end); self }
    pub fn build(self) -> ImeSetCompositionParams<'a> {
        ImeSetCompositionParams {
            text: self.text,
            selection_start: self.selection_start,
            selection_end: self.selection_end,
            replacement_start: self.replacement_start,
            replacement_end: self.replacement_end,
        }
    }
}

impl<'a> ImeSetCompositionParams<'a> { pub const METHOD: &'static str = "Input.imeSetComposition"; }

impl<'a> crate::CdpCommand<'a> for ImeSetCompositionParams<'a> {
    const METHOD: &'static str = "Input.imeSetComposition";
    type Response = crate::EmptyReturns;
}

/// Dispatches a mouse event to the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchMouseEventParams<'a> {
    /// Type of the mouse event.
    #[serde(rename = "type")]
    type_: Cow<'a, str>,
    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
    x: f64,
    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    y: f64,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    #[serde(skip_serializing_if = "Option::is_none")]
    modifiers: Option<i64>,
    /// Time at which the event occurred.
    #[serde(skip_serializing_if = "Option::is_none")]
    timestamp: Option<TimeSinceEpoch>,
    /// Mouse button (default: "none").
    #[serde(skip_serializing_if = "Option::is_none")]
    button: Option<MouseButton>,
    /// A number indicating which buttons are pressed on the mouse when a mouse event is triggered.
    /// Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
    #[serde(skip_serializing_if = "Option::is_none")]
    buttons: Option<i64>,
    /// Number of times the mouse button was clicked (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "clickCount")]
    click_count: Option<u64>,
    /// The normalized pressure, which has a range of \[0,1\] (default: 0).
    #[serde(skip_serializing_if = "Option::is_none")]
    force: Option<f64>,
    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "tangentialPressure")]
    tangential_pressure: Option<f64>,
    /// The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive tiltX is to the right (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "tiltX")]
    tilt_x: Option<f64>,
    /// The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range \[-90,90\], a positive tiltY is towards the user (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "tiltY")]
    tilt_y: Option<f64>,
    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
    #[serde(skip_serializing_if = "Option::is_none")]
    twist: Option<i64>,
    /// X delta in CSS pixels for mouse wheel event (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "deltaX")]
    delta_x: Option<f64>,
    /// Y delta in CSS pixels for mouse wheel event (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "deltaY")]
    delta_y: Option<f64>,
    /// Pointer type (default: "mouse").
    #[serde(skip_serializing_if = "Option::is_none", rename = "pointerType")]
    pointer_type: Option<Cow<'a, str>>,
}

impl<'a> DispatchMouseEventParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `type_`: Type of the mouse event.
    /// * `x`: X coordinate of the event relative to the main frame's viewport in CSS pixels.
    /// * `y`: Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    pub fn builder(type_: impl Into<Cow<'a, str>>, x: f64, y: f64) -> DispatchMouseEventParamsBuilder<'a> {
        DispatchMouseEventParamsBuilder {
            type_: type_.into(),
            x: x,
            y: y,
            modifiers: None,
            timestamp: None,
            button: None,
            buttons: None,
            click_count: None,
            force: None,
            tangential_pressure: None,
            tilt_x: None,
            tilt_y: None,
            twist: None,
            delta_x: None,
            delta_y: None,
            pointer_type: None,
        }
    }
    /// Type of the mouse event.
    pub fn type_(&self) -> &str { self.type_.as_ref() }
    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
    pub fn x(&self) -> f64 { self.x }
    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
    pub fn y(&self) -> f64 { self.y }
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
    /// Time at which the event occurred.
    pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
    /// Mouse button (default: "none").
    pub fn button(&self) -> Option<&MouseButton> { self.button.as_ref() }
    /// A number indicating which buttons are pressed on the mouse when a mouse event is triggered.
    /// Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
    pub fn buttons(&self) -> Option<i64> { self.buttons }
    /// Number of times the mouse button was clicked (default: 0).
    pub fn click_count(&self) -> Option<u64> { self.click_count }
    /// The normalized pressure, which has a range of \[0,1\] (default: 0).
    pub fn force(&self) -> Option<f64> { self.force }
    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
    pub fn tangential_pressure(&self) -> Option<f64> { self.tangential_pressure }
    /// The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive tiltX is to the right (default: 0).
    pub fn tilt_x(&self) -> Option<f64> { self.tilt_x }
    /// The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range \[-90,90\], a positive tiltY is towards the user (default: 0).
    pub fn tilt_y(&self) -> Option<f64> { self.tilt_y }
    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
    pub fn twist(&self) -> Option<i64> { self.twist }
    /// X delta in CSS pixels for mouse wheel event (default: 0).
    pub fn delta_x(&self) -> Option<f64> { self.delta_x }
    /// Y delta in CSS pixels for mouse wheel event (default: 0).
    pub fn delta_y(&self) -> Option<f64> { self.delta_y }
    /// Pointer type (default: "mouse").
    pub fn pointer_type(&self) -> Option<&str> { self.pointer_type.as_deref() }
}


pub struct DispatchMouseEventParamsBuilder<'a> {
    type_: Cow<'a, str>,
    x: f64,
    y: f64,
    modifiers: Option<i64>,
    timestamp: Option<TimeSinceEpoch>,
    button: Option<MouseButton>,
    buttons: Option<i64>,
    click_count: Option<u64>,
    force: Option<f64>,
    tangential_pressure: Option<f64>,
    tilt_x: Option<f64>,
    tilt_y: Option<f64>,
    twist: Option<i64>,
    delta_x: Option<f64>,
    delta_y: Option<f64>,
    pointer_type: Option<Cow<'a, str>>,
}

impl<'a> DispatchMouseEventParamsBuilder<'a> {
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
    /// Time at which the event occurred.
    pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
    /// Mouse button (default: "none").
    pub fn button(mut self, button: impl Into<MouseButton>) -> Self { self.button = Some(button.into()); self }
    /// A number indicating which buttons are pressed on the mouse when a mouse event is triggered.
    /// Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
    pub fn buttons(mut self, buttons: i64) -> Self { self.buttons = Some(buttons); self }
    /// Number of times the mouse button was clicked (default: 0).
    pub fn click_count(mut self, click_count: u64) -> Self { self.click_count = Some(click_count); self }
    /// The normalized pressure, which has a range of \[0,1\] (default: 0).
    pub fn force(mut self, force: f64) -> Self { self.force = Some(force); self }
    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
    pub fn tangential_pressure(mut self, tangential_pressure: f64) -> Self { self.tangential_pressure = Some(tangential_pressure); self }
    /// The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range \[-90,90\], a positive tiltX is to the right (default: 0).
    pub fn tilt_x(mut self, tilt_x: f64) -> Self { self.tilt_x = Some(tilt_x); self }
    /// The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range \[-90,90\], a positive tiltY is towards the user (default: 0).
    pub fn tilt_y(mut self, tilt_y: f64) -> Self { self.tilt_y = Some(tilt_y); self }
    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
    pub fn twist(mut self, twist: i64) -> Self { self.twist = Some(twist); self }
    /// X delta in CSS pixels for mouse wheel event (default: 0).
    pub fn delta_x(mut self, delta_x: f64) -> Self { self.delta_x = Some(delta_x); self }
    /// Y delta in CSS pixels for mouse wheel event (default: 0).
    pub fn delta_y(mut self, delta_y: f64) -> Self { self.delta_y = Some(delta_y); self }
    /// Pointer type (default: "mouse").
    pub fn pointer_type(mut self, pointer_type: impl Into<Cow<'a, str>>) -> Self { self.pointer_type = Some(pointer_type.into()); self }
    pub fn build(self) -> DispatchMouseEventParams<'a> {
        DispatchMouseEventParams {
            type_: self.type_,
            x: self.x,
            y: self.y,
            modifiers: self.modifiers,
            timestamp: self.timestamp,
            button: self.button,
            buttons: self.buttons,
            click_count: self.click_count,
            force: self.force,
            tangential_pressure: self.tangential_pressure,
            tilt_x: self.tilt_x,
            tilt_y: self.tilt_y,
            twist: self.twist,
            delta_x: self.delta_x,
            delta_y: self.delta_y,
            pointer_type: self.pointer_type,
        }
    }
}

impl<'a> DispatchMouseEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchMouseEvent"; }

impl<'a> crate::CdpCommand<'a> for DispatchMouseEventParams<'a> {
    const METHOD: &'static str = "Input.dispatchMouseEvent";
    type Response = crate::EmptyReturns;
}

/// Dispatches a touch event to the page.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchTouchEventParams<'a> {
    /// Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while
    /// TouchStart and TouchMove must contains at least one.
    #[serde(rename = "type")]
    type_: Cow<'a, str>,
    /// Active touch points on the touch device. One event per any changed point (compared to
    /// previous touch event in a sequence) is generated, emulating pressing/moving/releasing points
    /// one by one.
    #[serde(rename = "touchPoints")]
    touch_points: Vec<TouchPoint>,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    #[serde(skip_serializing_if = "Option::is_none")]
    modifiers: Option<i64>,
    /// Time at which the event occurred.
    #[serde(skip_serializing_if = "Option::is_none")]
    timestamp: Option<TimeSinceEpoch>,
}

impl<'a> DispatchTouchEventParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `type_`: Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.
    /// * `touch_points`: Active touch points on the touch device. One event per any changed point (compared to previous touch event in a sequence) is generated, emulating pressing/moving/releasing points one by one.
    pub fn builder(type_: impl Into<Cow<'a, str>>, touch_points: Vec<TouchPoint>) -> DispatchTouchEventParamsBuilder<'a> {
        DispatchTouchEventParamsBuilder {
            type_: type_.into(),
            touch_points: touch_points,
            modifiers: None,
            timestamp: None,
        }
    }
    /// Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while
    /// TouchStart and TouchMove must contains at least one.
    pub fn type_(&self) -> &str { self.type_.as_ref() }
    /// Active touch points on the touch device. One event per any changed point (compared to
    /// previous touch event in a sequence) is generated, emulating pressing/moving/releasing points
    /// one by one.
    pub fn touch_points(&self) -> &[TouchPoint] { &self.touch_points }
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
    /// Time at which the event occurred.
    pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
}


pub struct DispatchTouchEventParamsBuilder<'a> {
    type_: Cow<'a, str>,
    touch_points: Vec<TouchPoint>,
    modifiers: Option<i64>,
    timestamp: Option<TimeSinceEpoch>,
}

impl<'a> DispatchTouchEventParamsBuilder<'a> {
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
    /// Time at which the event occurred.
    pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
    pub fn build(self) -> DispatchTouchEventParams<'a> {
        DispatchTouchEventParams {
            type_: self.type_,
            touch_points: self.touch_points,
            modifiers: self.modifiers,
            timestamp: self.timestamp,
        }
    }
}

impl<'a> DispatchTouchEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchTouchEvent"; }

impl<'a> crate::CdpCommand<'a> for DispatchTouchEventParams<'a> {
    const METHOD: &'static str = "Input.dispatchTouchEvent";
    type Response = crate::EmptyReturns;
}

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

impl CancelDraggingParams { pub const METHOD: &'static str = "Input.cancelDragging"; }

impl<'a> crate::CdpCommand<'a> for CancelDraggingParams {
    const METHOD: &'static str = "Input.cancelDragging";
    type Response = crate::EmptyReturns;
}

/// Emulates touch event from the mouse event parameters.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct EmulateTouchFromMouseEventParams<'a> {
    /// Type of the mouse event.
    #[serde(rename = "type")]
    type_: Cow<'a, str>,
    /// X coordinate of the mouse pointer in DIP.
    x: i32,
    /// Y coordinate of the mouse pointer in DIP.
    y: i32,
    /// Mouse button. Only "none", "left", "right" are supported.
    button: MouseButton,
    /// Time at which the event occurred (default: current time).
    #[serde(skip_serializing_if = "Option::is_none")]
    timestamp: Option<TimeSinceEpoch>,
    /// X delta in DIP for mouse wheel event (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "deltaX")]
    delta_x: Option<f64>,
    /// Y delta in DIP for mouse wheel event (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "deltaY")]
    delta_y: Option<f64>,
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    #[serde(skip_serializing_if = "Option::is_none")]
    modifiers: Option<i64>,
    /// Number of times the mouse button was clicked (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "clickCount")]
    click_count: Option<u64>,
}

impl<'a> EmulateTouchFromMouseEventParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `type_`: Type of the mouse event.
    /// * `x`: X coordinate of the mouse pointer in DIP.
    /// * `y`: Y coordinate of the mouse pointer in DIP.
    /// * `button`: Mouse button. Only "none", "left", "right" are supported.
    pub fn builder(type_: impl Into<Cow<'a, str>>, x: i32, y: i32, button: impl Into<MouseButton>) -> EmulateTouchFromMouseEventParamsBuilder<'a> {
        EmulateTouchFromMouseEventParamsBuilder {
            type_: type_.into(),
            x: x,
            y: y,
            button: button.into(),
            timestamp: None,
            delta_x: None,
            delta_y: None,
            modifiers: None,
            click_count: None,
        }
    }
    /// Type of the mouse event.
    pub fn type_(&self) -> &str { self.type_.as_ref() }
    /// X coordinate of the mouse pointer in DIP.
    pub fn x(&self) -> i32 { self.x }
    /// Y coordinate of the mouse pointer in DIP.
    pub fn y(&self) -> i32 { self.y }
    /// Mouse button. Only "none", "left", "right" are supported.
    pub fn button(&self) -> &MouseButton { &self.button }
    /// Time at which the event occurred (default: current time).
    pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
    /// X delta in DIP for mouse wheel event (default: 0).
    pub fn delta_x(&self) -> Option<f64> { self.delta_x }
    /// Y delta in DIP for mouse wheel event (default: 0).
    pub fn delta_y(&self) -> Option<f64> { self.delta_y }
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
    /// Number of times the mouse button was clicked (default: 0).
    pub fn click_count(&self) -> Option<u64> { self.click_count }
}


pub struct EmulateTouchFromMouseEventParamsBuilder<'a> {
    type_: Cow<'a, str>,
    x: i32,
    y: i32,
    button: MouseButton,
    timestamp: Option<TimeSinceEpoch>,
    delta_x: Option<f64>,
    delta_y: Option<f64>,
    modifiers: Option<i64>,
    click_count: Option<u64>,
}

impl<'a> EmulateTouchFromMouseEventParamsBuilder<'a> {
    /// Time at which the event occurred (default: current time).
    pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
    /// X delta in DIP for mouse wheel event (default: 0).
    pub fn delta_x(mut self, delta_x: f64) -> Self { self.delta_x = Some(delta_x); self }
    /// Y delta in DIP for mouse wheel event (default: 0).
    pub fn delta_y(mut self, delta_y: f64) -> Self { self.delta_y = Some(delta_y); self }
    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
    /// (default: 0).
    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
    /// Number of times the mouse button was clicked (default: 0).
    pub fn click_count(mut self, click_count: u64) -> Self { self.click_count = Some(click_count); self }
    pub fn build(self) -> EmulateTouchFromMouseEventParams<'a> {
        EmulateTouchFromMouseEventParams {
            type_: self.type_,
            x: self.x,
            y: self.y,
            button: self.button,
            timestamp: self.timestamp,
            delta_x: self.delta_x,
            delta_y: self.delta_y,
            modifiers: self.modifiers,
            click_count: self.click_count,
        }
    }
}

impl<'a> EmulateTouchFromMouseEventParams<'a> { pub const METHOD: &'static str = "Input.emulateTouchFromMouseEvent"; }

impl<'a> crate::CdpCommand<'a> for EmulateTouchFromMouseEventParams<'a> {
    const METHOD: &'static str = "Input.emulateTouchFromMouseEvent";
    type Response = crate::EmptyReturns;
}

/// Ignores input events (useful while auditing page).

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetIgnoreInputEventsParams {
    /// Ignores input events processing when set to true.
    ignore: bool,
}

impl SetIgnoreInputEventsParams {
    /// Creates a builder for this type with the required parameters:
    /// * `ignore`: Ignores input events processing when set to true.
    pub fn builder(ignore: bool) -> SetIgnoreInputEventsParamsBuilder {
        SetIgnoreInputEventsParamsBuilder {
            ignore: ignore,
        }
    }
    /// Ignores input events processing when set to true.
    pub fn ignore(&self) -> bool { self.ignore }
}


pub struct SetIgnoreInputEventsParamsBuilder {
    ignore: bool,
}

impl SetIgnoreInputEventsParamsBuilder {
    pub fn build(self) -> SetIgnoreInputEventsParams {
        SetIgnoreInputEventsParams {
            ignore: self.ignore,
        }
    }
}

impl SetIgnoreInputEventsParams { pub const METHOD: &'static str = "Input.setIgnoreInputEvents"; }

impl<'a> crate::CdpCommand<'a> for SetIgnoreInputEventsParams {
    const METHOD: &'static str = "Input.setIgnoreInputEvents";
    type Response = crate::EmptyReturns;
}

/// Prevents default drag and drop behavior and instead emits 'Input.dragIntercepted' events.
/// Drag and drop behavior can be directly controlled via 'Input.dispatchDragEvent'.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetInterceptDragsParams {
    enabled: bool,
}

impl SetInterceptDragsParams {
    /// Creates a builder for this type with the required parameters:
    /// * `enabled`: 
    pub fn builder(enabled: bool) -> SetInterceptDragsParamsBuilder {
        SetInterceptDragsParamsBuilder {
            enabled: enabled,
        }
    }
    pub fn enabled(&self) -> bool { self.enabled }
}


pub struct SetInterceptDragsParamsBuilder {
    enabled: bool,
}

impl SetInterceptDragsParamsBuilder {
    pub fn build(self) -> SetInterceptDragsParams {
        SetInterceptDragsParams {
            enabled: self.enabled,
        }
    }
}

impl SetInterceptDragsParams { pub const METHOD: &'static str = "Input.setInterceptDrags"; }

impl<'a> crate::CdpCommand<'a> for SetInterceptDragsParams {
    const METHOD: &'static str = "Input.setInterceptDrags";
    type Response = crate::EmptyReturns;
}

/// Synthesizes a pinch gesture over a time period by issuing appropriate touch events.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SynthesizePinchGestureParams {
    /// X coordinate of the start of the gesture in CSS pixels.
    x: f64,
    /// Y coordinate of the start of the gesture in CSS pixels.
    y: f64,
    /// Relative scale factor after zooming (\>1.0 zooms in, \<1.0 zooms out).
    #[serde(rename = "scaleFactor")]
    scale_factor: f64,
    /// Relative pointer speed in pixels per second (default: 800).
    #[serde(skip_serializing_if = "Option::is_none", rename = "relativeSpeed")]
    relative_speed: Option<i64>,
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).
    #[serde(skip_serializing_if = "Option::is_none", rename = "gestureSourceType")]
    gesture_source_type: Option<GestureSourceType>,
}

impl SynthesizePinchGestureParams {
    /// Creates a builder for this type with the required parameters:
    /// * `x`: X coordinate of the start of the gesture in CSS pixels.
    /// * `y`: Y coordinate of the start of the gesture in CSS pixels.
    /// * `scale_factor`: Relative scale factor after zooming (\>1.0 zooms in, \<1.0 zooms out).
    pub fn builder(x: f64, y: f64, scale_factor: f64) -> SynthesizePinchGestureParamsBuilder {
        SynthesizePinchGestureParamsBuilder {
            x: x,
            y: y,
            scale_factor: scale_factor,
            relative_speed: None,
            gesture_source_type: None,
        }
    }
    /// X coordinate of the start of the gesture in CSS pixels.
    pub fn x(&self) -> f64 { self.x }
    /// Y coordinate of the start of the gesture in CSS pixels.
    pub fn y(&self) -> f64 { self.y }
    /// Relative scale factor after zooming (\>1.0 zooms in, \<1.0 zooms out).
    pub fn scale_factor(&self) -> f64 { self.scale_factor }
    /// Relative pointer speed in pixels per second (default: 800).
    pub fn relative_speed(&self) -> Option<i64> { self.relative_speed }
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).
    pub fn gesture_source_type(&self) -> Option<&GestureSourceType> { self.gesture_source_type.as_ref() }
}


pub struct SynthesizePinchGestureParamsBuilder {
    x: f64,
    y: f64,
    scale_factor: f64,
    relative_speed: Option<i64>,
    gesture_source_type: Option<GestureSourceType>,
}

impl SynthesizePinchGestureParamsBuilder {
    /// Relative pointer speed in pixels per second (default: 800).
    pub fn relative_speed(mut self, relative_speed: i64) -> Self { self.relative_speed = Some(relative_speed); self }
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).
    pub fn gesture_source_type(mut self, gesture_source_type: impl Into<GestureSourceType>) -> Self { self.gesture_source_type = Some(gesture_source_type.into()); self }
    pub fn build(self) -> SynthesizePinchGestureParams {
        SynthesizePinchGestureParams {
            x: self.x,
            y: self.y,
            scale_factor: self.scale_factor,
            relative_speed: self.relative_speed,
            gesture_source_type: self.gesture_source_type,
        }
    }
}

impl SynthesizePinchGestureParams { pub const METHOD: &'static str = "Input.synthesizePinchGesture"; }

impl<'a> crate::CdpCommand<'a> for SynthesizePinchGestureParams {
    const METHOD: &'static str = "Input.synthesizePinchGesture";
    type Response = crate::EmptyReturns;
}

/// Synthesizes a scroll gesture over a time period by issuing appropriate touch events.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SynthesizeScrollGestureParams<'a> {
    /// X coordinate of the start of the gesture in CSS pixels.
    x: f64,
    /// Y coordinate of the start of the gesture in CSS pixels.
    y: f64,
    /// The distance to scroll along the X axis (positive to scroll left).
    #[serde(skip_serializing_if = "Option::is_none", rename = "xDistance")]
    x_distance: Option<f64>,
    /// The distance to scroll along the Y axis (positive to scroll up).
    #[serde(skip_serializing_if = "Option::is_none", rename = "yDistance")]
    y_distance: Option<f64>,
    /// The number of additional pixels to scroll back along the X axis, in addition to the given
    /// distance.
    #[serde(skip_serializing_if = "Option::is_none", rename = "xOverscroll")]
    x_overscroll: Option<f64>,
    /// The number of additional pixels to scroll back along the Y axis, in addition to the given
    /// distance.
    #[serde(skip_serializing_if = "Option::is_none", rename = "yOverscroll")]
    y_overscroll: Option<f64>,
    /// Prevent fling (default: true).
    #[serde(skip_serializing_if = "Option::is_none", rename = "preventFling")]
    prevent_fling: Option<bool>,
    /// Swipe speed in pixels per second (default: 800).
    #[serde(skip_serializing_if = "Option::is_none")]
    speed: Option<i64>,
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).
    #[serde(skip_serializing_if = "Option::is_none", rename = "gestureSourceType")]
    gesture_source_type: Option<GestureSourceType>,
    /// The number of times to repeat the gesture (default: 0).
    #[serde(skip_serializing_if = "Option::is_none", rename = "repeatCount")]
    repeat_count: Option<u64>,
    /// The number of milliseconds delay between each repeat. (default: 250).
    #[serde(skip_serializing_if = "Option::is_none", rename = "repeatDelayMs")]
    repeat_delay_ms: Option<i64>,
    /// The name of the interaction markers to generate, if not empty (default: "").
    #[serde(skip_serializing_if = "Option::is_none", rename = "interactionMarkerName")]
    interaction_marker_name: Option<Cow<'a, str>>,
}

impl<'a> SynthesizeScrollGestureParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `x`: X coordinate of the start of the gesture in CSS pixels.
    /// * `y`: Y coordinate of the start of the gesture in CSS pixels.
    pub fn builder(x: f64, y: f64) -> SynthesizeScrollGestureParamsBuilder<'a> {
        SynthesizeScrollGestureParamsBuilder {
            x: x,
            y: y,
            x_distance: None,
            y_distance: None,
            x_overscroll: None,
            y_overscroll: None,
            prevent_fling: None,
            speed: None,
            gesture_source_type: None,
            repeat_count: None,
            repeat_delay_ms: None,
            interaction_marker_name: None,
        }
    }
    /// X coordinate of the start of the gesture in CSS pixels.
    pub fn x(&self) -> f64 { self.x }
    /// Y coordinate of the start of the gesture in CSS pixels.
    pub fn y(&self) -> f64 { self.y }
    /// The distance to scroll along the X axis (positive to scroll left).
    pub fn x_distance(&self) -> Option<f64> { self.x_distance }
    /// The distance to scroll along the Y axis (positive to scroll up).
    pub fn y_distance(&self) -> Option<f64> { self.y_distance }
    /// The number of additional pixels to scroll back along the X axis, in addition to the given
    /// distance.
    pub fn x_overscroll(&self) -> Option<f64> { self.x_overscroll }
    /// The number of additional pixels to scroll back along the Y axis, in addition to the given
    /// distance.
    pub fn y_overscroll(&self) -> Option<f64> { self.y_overscroll }
    /// Prevent fling (default: true).
    pub fn prevent_fling(&self) -> Option<bool> { self.prevent_fling }
    /// Swipe speed in pixels per second (default: 800).
    pub fn speed(&self) -> Option<i64> { self.speed }
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).
    pub fn gesture_source_type(&self) -> Option<&GestureSourceType> { self.gesture_source_type.as_ref() }
    /// The number of times to repeat the gesture (default: 0).
    pub fn repeat_count(&self) -> Option<u64> { self.repeat_count }
    /// The number of milliseconds delay between each repeat. (default: 250).
    pub fn repeat_delay_ms(&self) -> Option<i64> { self.repeat_delay_ms }
    /// The name of the interaction markers to generate, if not empty (default: "").
    pub fn interaction_marker_name(&self) -> Option<&str> { self.interaction_marker_name.as_deref() }
}


pub struct SynthesizeScrollGestureParamsBuilder<'a> {
    x: f64,
    y: f64,
    x_distance: Option<f64>,
    y_distance: Option<f64>,
    x_overscroll: Option<f64>,
    y_overscroll: Option<f64>,
    prevent_fling: Option<bool>,
    speed: Option<i64>,
    gesture_source_type: Option<GestureSourceType>,
    repeat_count: Option<u64>,
    repeat_delay_ms: Option<i64>,
    interaction_marker_name: Option<Cow<'a, str>>,
}

impl<'a> SynthesizeScrollGestureParamsBuilder<'a> {
    /// The distance to scroll along the X axis (positive to scroll left).
    pub fn x_distance(mut self, x_distance: f64) -> Self { self.x_distance = Some(x_distance); self }
    /// The distance to scroll along the Y axis (positive to scroll up).
    pub fn y_distance(mut self, y_distance: f64) -> Self { self.y_distance = Some(y_distance); self }
    /// The number of additional pixels to scroll back along the X axis, in addition to the given
    /// distance.
    pub fn x_overscroll(mut self, x_overscroll: f64) -> Self { self.x_overscroll = Some(x_overscroll); self }
    /// The number of additional pixels to scroll back along the Y axis, in addition to the given
    /// distance.
    pub fn y_overscroll(mut self, y_overscroll: f64) -> Self { self.y_overscroll = Some(y_overscroll); self }
    /// Prevent fling (default: true).
    pub fn prevent_fling(mut self, prevent_fling: bool) -> Self { self.prevent_fling = Some(prevent_fling); self }
    /// Swipe speed in pixels per second (default: 800).
    pub fn speed(mut self, speed: i64) -> Self { self.speed = Some(speed); self }
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).
    pub fn gesture_source_type(mut self, gesture_source_type: impl Into<GestureSourceType>) -> Self { self.gesture_source_type = Some(gesture_source_type.into()); self }
    /// The number of times to repeat the gesture (default: 0).
    pub fn repeat_count(mut self, repeat_count: u64) -> Self { self.repeat_count = Some(repeat_count); self }
    /// The number of milliseconds delay between each repeat. (default: 250).
    pub fn repeat_delay_ms(mut self, repeat_delay_ms: i64) -> Self { self.repeat_delay_ms = Some(repeat_delay_ms); self }
    /// The name of the interaction markers to generate, if not empty (default: "").
    pub fn interaction_marker_name(mut self, interaction_marker_name: impl Into<Cow<'a, str>>) -> Self { self.interaction_marker_name = Some(interaction_marker_name.into()); self }
    pub fn build(self) -> SynthesizeScrollGestureParams<'a> {
        SynthesizeScrollGestureParams {
            x: self.x,
            y: self.y,
            x_distance: self.x_distance,
            y_distance: self.y_distance,
            x_overscroll: self.x_overscroll,
            y_overscroll: self.y_overscroll,
            prevent_fling: self.prevent_fling,
            speed: self.speed,
            gesture_source_type: self.gesture_source_type,
            repeat_count: self.repeat_count,
            repeat_delay_ms: self.repeat_delay_ms,
            interaction_marker_name: self.interaction_marker_name,
        }
    }
}

impl<'a> SynthesizeScrollGestureParams<'a> { pub const METHOD: &'static str = "Input.synthesizeScrollGesture"; }

impl<'a> crate::CdpCommand<'a> for SynthesizeScrollGestureParams<'a> {
    const METHOD: &'static str = "Input.synthesizeScrollGesture";
    type Response = crate::EmptyReturns;
}

/// Synthesizes a tap gesture over a time period by issuing appropriate touch events.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SynthesizeTapGestureParams {
    /// X coordinate of the start of the gesture in CSS pixels.
    x: f64,
    /// Y coordinate of the start of the gesture in CSS pixels.
    y: f64,
    /// Duration between touchdown and touchup events in ms (default: 50).
    #[serde(skip_serializing_if = "Option::is_none")]
    duration: Option<i64>,
    /// Number of times to perform the tap (e.g. 2 for double tap, default: 1).
    #[serde(skip_serializing_if = "Option::is_none", rename = "tapCount")]
    tap_count: Option<u64>,
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).
    #[serde(skip_serializing_if = "Option::is_none", rename = "gestureSourceType")]
    gesture_source_type: Option<GestureSourceType>,
}

impl SynthesizeTapGestureParams {
    /// Creates a builder for this type with the required parameters:
    /// * `x`: X coordinate of the start of the gesture in CSS pixels.
    /// * `y`: Y coordinate of the start of the gesture in CSS pixels.
    pub fn builder(x: f64, y: f64) -> SynthesizeTapGestureParamsBuilder {
        SynthesizeTapGestureParamsBuilder {
            x: x,
            y: y,
            duration: None,
            tap_count: None,
            gesture_source_type: None,
        }
    }
    /// X coordinate of the start of the gesture in CSS pixels.
    pub fn x(&self) -> f64 { self.x }
    /// Y coordinate of the start of the gesture in CSS pixels.
    pub fn y(&self) -> f64 { self.y }
    /// Duration between touchdown and touchup events in ms (default: 50).
    pub fn duration(&self) -> Option<i64> { self.duration }
    /// Number of times to perform the tap (e.g. 2 for double tap, default: 1).
    pub fn tap_count(&self) -> Option<u64> { self.tap_count }
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).
    pub fn gesture_source_type(&self) -> Option<&GestureSourceType> { self.gesture_source_type.as_ref() }
}


pub struct SynthesizeTapGestureParamsBuilder {
    x: f64,
    y: f64,
    duration: Option<i64>,
    tap_count: Option<u64>,
    gesture_source_type: Option<GestureSourceType>,
}

impl SynthesizeTapGestureParamsBuilder {
    /// Duration between touchdown and touchup events in ms (default: 50).
    pub fn duration(mut self, duration: i64) -> Self { self.duration = Some(duration); self }
    /// Number of times to perform the tap (e.g. 2 for double tap, default: 1).
    pub fn tap_count(mut self, tap_count: u64) -> Self { self.tap_count = Some(tap_count); self }
    /// Which type of input events to be generated (default: 'default', which queries the platform
    /// for the preferred input type).
    pub fn gesture_source_type(mut self, gesture_source_type: impl Into<GestureSourceType>) -> Self { self.gesture_source_type = Some(gesture_source_type.into()); self }
    pub fn build(self) -> SynthesizeTapGestureParams {
        SynthesizeTapGestureParams {
            x: self.x,
            y: self.y,
            duration: self.duration,
            tap_count: self.tap_count,
            gesture_source_type: self.gesture_source_type,
        }
    }
}

impl SynthesizeTapGestureParams { pub const METHOD: &'static str = "Input.synthesizeTapGesture"; }

impl<'a> crate::CdpCommand<'a> for SynthesizeTapGestureParams {
    const METHOD: &'static str = "Input.synthesizeTapGesture";
    type Response = crate::EmptyReturns;
}