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
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.

//! Debugger domain exposes JavaScript debugging capabilities. It allows
//! setting and removing breakpoints, stepping through execution, exploring
//! stack traces, etc.
//!
//! Types, command parameters and event payloads for the `Debugger`
//! domain. The method-name constants for the same domain are in
//! [`crate::methods`].

use serde::{Deserialize, Serialize};

/// Breakpoint identifier.
pub type BreakpointId = String;

/// Call frame identifier.
pub type CallFrameId = String;

/// Location in the source code.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Location {
    /// Script identifier as reported in the `Debugger.scriptParsed`.
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
    /// Line number in the script (0-based).
    #[serde(rename = "lineNumber")]
    pub line_number: i64,
    /// Column number in the script (0-based).
    #[serde(
        rename = "columnNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub column_number: Option<i64>,
}

/// Location in the source code.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ScriptPosition {
    #[serde(rename = "lineNumber")]
    pub line_number: i64,
    #[serde(rename = "columnNumber")]
    pub column_number: i64,
}

/// Location range within one script.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct LocationRange {
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
    pub start: ScriptPosition,
    pub end: ScriptPosition,
}

/// JavaScript call frame. Array of call frames form the call stack.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CallFrame {
    /// Call frame identifier. This identifier is only valid while the virtual
    /// machine is paused.
    #[serde(rename = "callFrameId")]
    pub call_frame_id: CallFrameId,
    /// Name of the JavaScript function called on this call frame.
    #[serde(rename = "functionName")]
    pub function_name: String,
    /// Location in the source code.
    #[serde(
        rename = "functionLocation",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub function_location: Option<Location>,
    /// Location in the source code.
    pub location: Location,
    /// JavaScript script name or url. Deprecated in favor of using the
    /// `location.scriptId` to resolve the URL via a previously sent
    /// `Debugger.scriptParsed` event.
    ///
    /// Deprecated in the protocol.
    pub url: String,
    /// Scope chain for this call frame.
    #[serde(rename = "scopeChain")]
    pub scope_chain: Vec<Scope>,
    /// `this` object for this call frame.
    pub this: crate::protocol::runtime::RemoteObject,
    /// The value being returned, if the function is at return point.
    #[serde(
        rename = "returnValue",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub return_value: Option<crate::protocol::runtime::RemoteObject>,
    /// Valid only while the VM is paused and indicates whether this frame can be
    /// restarted or not. Note that a `true` value here does not guarantee that
    /// Debugger#restartFrame with this CallFrameId will be successful, but it is
    /// very likely.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "canBeRestarted",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub can_be_restarted: Option<bool>,
}

/// Scope description.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Scope {
    /// Scope type.
    pub r#type: ScopeType,
    /// Object representing the scope. For `global` and `with` scopes it
    /// represents the actual object; for the rest of the scopes, it is artificial
    /// transient object enumerating scope variables as its properties.
    pub object: crate::protocol::runtime::RemoteObject,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Location in the source code where scope starts
    #[serde(
        rename = "startLocation",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub start_location: Option<Location>,
    /// Location in the source code where scope ends
    #[serde(
        rename = "endLocation",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub end_location: Option<Location>,
    /// Present if the scope has no variable values to show. Absent means that the
    /// scope declares at least one variable with an available value. Empty scopes
    /// are retained in the scope chain because they can be targeted via
    /// `evaluateOnCallFrame` (using `scopeNumber`) or matched against scopes in
    /// source maps.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "emptyReason",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub empty_reason: Option<ScopeEmptyReason>,
}

/// The values `type` accepts on `Scope`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ScopeType {
    /// `global`
    #[serde(rename = "global")]
    Global,
    /// `local`
    #[serde(rename = "local")]
    Local,
    /// `with`
    #[serde(rename = "with")]
    With,
    /// `closure`
    #[serde(rename = "closure")]
    Closure,
    /// `catch`
    #[serde(rename = "catch")]
    Catch,
    /// `block`
    #[serde(rename = "block")]
    Block,
    /// `script`
    #[serde(rename = "script")]
    Script,
    /// `eval`
    #[serde(rename = "eval")]
    Eval,
    /// `module`
    #[serde(rename = "module")]
    Module,
    /// `wasm-expression-stack`
    #[serde(rename = "wasm-expression-stack")]
    WasmExpressionStack,
    /// 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 `emptyReason` accepts on `Scope`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ScopeEmptyReason {
    /// `no-variables`
    #[serde(rename = "no-variables")]
    NoVariables,
    /// `all-unavailable`
    #[serde(rename = "all-unavailable")]
    AllUnavailable,
    /// 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),
}

/// Search match for resource.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SearchMatch {
    /// Line number in resource content.
    #[serde(rename = "lineNumber")]
    pub line_number: f64,
    /// Line with match content.
    #[serde(rename = "lineContent")]
    pub line_content: String,
}

#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct BreakLocation {
    /// Script identifier as reported in the `Debugger.scriptParsed`.
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
    /// Line number in the script (0-based).
    #[serde(rename = "lineNumber")]
    pub line_number: i64,
    /// Column number in the script (0-based).
    #[serde(
        rename = "columnNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub column_number: Option<i64>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<BreakLocationType>,
}

/// The values `type` accepts on `BreakLocation`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum BreakLocationType {
    /// `debuggerStatement`
    #[serde(rename = "debuggerStatement")]
    DebuggerStatement,
    /// `call`
    #[serde(rename = "call")]
    Call,
    /// `return`
    #[serde(rename = "return")]
    Return,
    /// 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 WasmDisassemblyChunk {
    /// The next chunk of disassembled lines.
    pub lines: Vec<String>,
    /// The bytecode offsets describing the start of each line.
    #[serde(rename = "bytecodeOffsets")]
    pub bytecode_offsets: Vec<i64>,
}

/// Enum of possible script languages.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ScriptLanguage {
    /// `JavaScript`
    JavaScript,
    /// `WebAssembly`
    WebAssembly,
    /// 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),
}

/// Debug symbols available for a wasm script.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DebugSymbols {
    /// Type of the debug symbols.
    pub r#type: DebugSymbolsType,
    /// URL of the external symbol source.
    #[serde(
        rename = "externalURL",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub external_url: Option<String>,
}

/// The values `type` accepts on `DebugSymbols`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DebugSymbolsType {
    /// `SourceMap`
    SourceMap,
    /// `EmbeddedDWARF`
    #[serde(rename = "EmbeddedDWARF")]
    EmbeddedDwarf,
    /// `ExternalDWARF`
    #[serde(rename = "ExternalDWARF")]
    ExternalDwarf,
    /// 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 ResolvedBreakpoint {
    /// Breakpoint unique identifier.
    #[serde(rename = "breakpointId")]
    pub breakpoint_id: BreakpointId,
    /// Actual breakpoint location.
    pub location: Location,
}

/// Continues execution until specific location is reached.
///
/// Parameters of `Debugger.continueToLocation`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ContinueToLocationParams {
    /// Location to continue to.
    pub location: Location,
    #[serde(
        rename = "targetCallFrames",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub target_call_frames: Option<ContinueToLocationTargetCallFrames>,
}

/// The values `targetCallFrames` accepts on `continueToLocation`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ContinueToLocationTargetCallFrames {
    /// `any`
    #[serde(rename = "any")]
    Any,
    /// `current`
    #[serde(rename = "current")]
    Current,
    /// 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 ContinueToLocationParams {
    const METHOD: &'static str = "Debugger.continueToLocation";
    type Returns = crate::typed::NoReturns;
}

/// Disables debugger for given page.
///
/// Parameters of `Debugger.disable`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisableParams {}

impl crate::typed::Command for DisableParams {
    const METHOD: &'static str = "Debugger.disable";
    type Returns = crate::typed::NoReturns;
}

/// Enables debugger for the given page. Clients should not assume that the
/// debugging has been enabled until the result for this command is received.
///
/// Parameters of `Debugger.enable`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct EnableParams {
    /// The maximum size in bytes of collected scripts (not referenced by other
    /// heap objects) the debugger can hold. Puts no limit if parameter is
    /// omitted.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "maxScriptsCacheSize",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_scripts_cache_size: Option<f64>,
}

/// What `Debugger.enable` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct EnableReturns {
    /// Unique identifier of the debugger.
    ///
    /// Experimental: may change without notice.
    #[serde(rename = "debuggerId")]
    pub debugger_id: crate::protocol::runtime::UniqueDebuggerId,
}

impl crate::typed::Command for EnableParams {
    const METHOD: &'static str = "Debugger.enable";
    type Returns = EnableReturns;
}

/// Evaluates expression on a given call frame.
///
/// Parameters of `Debugger.evaluateOnCallFrame`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct EvaluateOnCallFrameParams {
    /// Call frame identifier to evaluate on.
    #[serde(rename = "callFrameId")]
    pub call_frame_id: CallFrameId,
    /// Expression to evaluate.
    pub expression: String,
    /// String object group name to put result into (allows rapid releasing
    /// resulting object handles using `releaseObjectGroup`).
    #[serde(
        rename = "objectGroup",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub object_group: Option<String>,
    /// Specifies whether command line API should be available to the evaluated
    /// expression, defaults to false.
    #[serde(
        rename = "includeCommandLineAPI",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub include_command_line_api: Option<bool>,
    /// In silent mode exceptions thrown during evaluation are not reported and do
    /// not pause execution. Overrides `setPauseOnException` state.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub silent: Option<bool>,
    /// Whether the result is expected to be a JSON object that should be sent by
    /// value.
    #[serde(
        rename = "returnByValue",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub return_by_value: Option<bool>,
    /// Whether preview should be generated for the result.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "generatePreview",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub generate_preview: Option<bool>,
    /// Whether to throw an exception if side effect cannot be ruled out during
    /// evaluation.
    #[serde(
        rename = "throwOnSideEffect",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub throw_on_side_effect: Option<bool>,
    /// Terminate execution after timing out (number of milliseconds).
    ///
    /// Experimental: may change without notice.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub timeout: Option<crate::protocol::runtime::TimeDelta>,
    /// Specifies the scope number to evaluate the expression in (default: 0,
    /// innermost scope).
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "scopeNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub scope_number: Option<i64>,
}

/// What `Debugger.evaluateOnCallFrame` answers with.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EvaluateOnCallFrameReturns {
    /// Object wrapper for the evaluation result.
    pub result: crate::protocol::runtime::RemoteObject,
    /// Exception details.
    #[serde(
        rename = "exceptionDetails",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub exception_details: Option<crate::protocol::runtime::ExceptionDetails>,
}

impl crate::typed::Command for EvaluateOnCallFrameParams {
    const METHOD: &'static str = "Debugger.evaluateOnCallFrame";
    type Returns = EvaluateOnCallFrameReturns;
}

/// Returns possible locations for breakpoint. scriptId in start and end range
/// locations should be the same.
///
/// Parameters of `Debugger.getPossibleBreakpoints`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetPossibleBreakpointsParams {
    /// Start of range to search possible breakpoint locations in.
    pub start: Location,
    /// End of range to search possible breakpoint locations in (excluding). When
    /// not specified, end of scripts is used as end of range.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end: Option<Location>,
    /// Only consider locations which are in the same (non-nested) function as
    /// start.
    #[serde(
        rename = "restrictToFunction",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub restrict_to_function: Option<bool>,
}

/// What `Debugger.getPossibleBreakpoints` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetPossibleBreakpointsReturns {
    /// List of the possible breakpoint locations.
    pub locations: Vec<BreakLocation>,
}

impl crate::typed::Command for GetPossibleBreakpointsParams {
    const METHOD: &'static str = "Debugger.getPossibleBreakpoints";
    type Returns = GetPossibleBreakpointsReturns;
}

/// Returns source for the script with given id.
///
/// Parameters of `Debugger.getScriptSource`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetScriptSourceParams {
    /// Id of the script to get source for.
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
}

/// What `Debugger.getScriptSource` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetScriptSourceReturns {
    /// Script source (empty in case of Wasm bytecode).
    #[serde(rename = "scriptSource")]
    pub script_source: String,
    /// Wasm bytecode. (Encoded as a base64 string when passed over JSON)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub bytecode: Option<String>,
}

impl crate::typed::Command for GetScriptSourceParams {
    const METHOD: &'static str = "Debugger.getScriptSource";
    type Returns = GetScriptSourceReturns;
}

/// Experimental: may change without notice.
///
/// Parameters of `Debugger.disassembleWasmModule`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisassembleWasmModuleParams {
    /// Id of the script to disassemble
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
}

/// What `Debugger.disassembleWasmModule` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisassembleWasmModuleReturns {
    /// For large modules, return a stream from which additional chunks of
    /// disassembly can be read successively.
    #[serde(rename = "streamId", default, skip_serializing_if = "Option::is_none")]
    pub stream_id: Option<String>,
    /// The total number of lines in the disassembly text.
    #[serde(rename = "totalNumberOfLines")]
    pub total_number_of_lines: i64,
    /// The offsets of all function bodies, in the format \[start1, end1, start2,
    /// end2, ...\] where all ends are exclusive.
    #[serde(rename = "functionBodyOffsets")]
    pub function_body_offsets: Vec<i64>,
    /// The first chunk of disassembly.
    pub chunk: WasmDisassemblyChunk,
}

impl crate::typed::Command for DisassembleWasmModuleParams {
    const METHOD: &'static str = "Debugger.disassembleWasmModule";
    type Returns = DisassembleWasmModuleReturns;
}

/// Disassemble the next chunk of lines for the module corresponding to the
/// stream. If disassembly is complete, this API will invalidate the streamId
/// and return an empty chunk. Any subsequent calls for the now invalid stream
/// will return errors.
///
/// Experimental: may change without notice.
///
/// Parameters of `Debugger.nextWasmDisassemblyChunk`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct NextWasmDisassemblyChunkParams {
    #[serde(rename = "streamId")]
    pub stream_id: String,
}

/// What `Debugger.nextWasmDisassemblyChunk` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct NextWasmDisassemblyChunkReturns {
    /// The next chunk of disassembly.
    pub chunk: WasmDisassemblyChunk,
}

impl crate::typed::Command for NextWasmDisassemblyChunkParams {
    const METHOD: &'static str = "Debugger.nextWasmDisassemblyChunk";
    type Returns = NextWasmDisassemblyChunkReturns;
}

/// This command is deprecated. Use getScriptSource instead.
///
/// Deprecated in the protocol.
///
/// Parameters of `Debugger.getWasmBytecode`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetWasmBytecodeParams {
    /// Id of the Wasm script to get source for.
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
}

/// What `Debugger.getWasmBytecode` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetWasmBytecodeReturns {
    /// Script source. (Encoded as a base64 string when passed over JSON)
    pub bytecode: String,
}

impl crate::typed::Command for GetWasmBytecodeParams {
    const METHOD: &'static str = "Debugger.getWasmBytecode";
    type Returns = GetWasmBytecodeReturns;
}

/// Returns stack trace with given `stackTraceId`.
///
/// Experimental: may change without notice.
///
/// Parameters of `Debugger.getStackTrace`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetStackTraceParams {
    #[serde(rename = "stackTraceId")]
    pub stack_trace_id: crate::protocol::runtime::StackTraceId,
}

/// What `Debugger.getStackTrace` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetStackTraceReturns {
    #[serde(rename = "stackTrace")]
    pub stack_trace: crate::protocol::runtime::StackTrace,
}

impl crate::typed::Command for GetStackTraceParams {
    const METHOD: &'static str = "Debugger.getStackTrace";
    type Returns = GetStackTraceReturns;
}

/// Stops on the next JavaScript statement.
///
/// Parameters of `Debugger.pause`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct PauseParams {}

impl crate::typed::Command for PauseParams {
    const METHOD: &'static str = "Debugger.pause";
    type Returns = crate::typed::NoReturns;
}

/// Deprecated in the protocol.
///
/// Experimental: may change without notice.
///
/// Parameters of `Debugger.pauseOnAsyncCall`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct PauseOnAsyncCallParams {
    /// Debugger will pause when async call with given stack trace is started.
    #[serde(rename = "parentStackTraceId")]
    pub parent_stack_trace_id: crate::protocol::runtime::StackTraceId,
}

impl crate::typed::Command for PauseOnAsyncCallParams {
    const METHOD: &'static str = "Debugger.pauseOnAsyncCall";
    type Returns = crate::typed::NoReturns;
}

/// Removes JavaScript breakpoint.
///
/// Parameters of `Debugger.removeBreakpoint`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemoveBreakpointParams {
    #[serde(rename = "breakpointId")]
    pub breakpoint_id: BreakpointId,
}

impl crate::typed::Command for RemoveBreakpointParams {
    const METHOD: &'static str = "Debugger.removeBreakpoint";
    type Returns = crate::typed::NoReturns;
}

/// Restarts particular call frame from the beginning. The old, deprecated
/// behavior of `restartFrame` is to stay paused and allow further CDP
/// commands after a restart was scheduled. This can cause problems with
/// restarting, so we now continue execution immediatly after it has been
/// scheduled until we reach the beginning of the restarted frame. To stay
/// back-wards compatible, `restartFrame` now expects a `mode` parameter to be
/// present. If the `mode` parameter is missing, `restartFrame` errors out.
/// The various return values are deprecated and `callFrames` is always empty.
/// Use the call frames from the `Debugger#paused` events instead, that fires
/// once V8 pauses at the beginning of the restarted function.
///
/// Parameters of `Debugger.restartFrame`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RestartFrameParams {
    /// Call frame identifier to evaluate on.
    #[serde(rename = "callFrameId")]
    pub call_frame_id: CallFrameId,
    /// The `mode` parameter must be present and set to 'StepInto', otherwise
    /// `restartFrame` will error out.
    ///
    /// Experimental: may change without notice.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mode: Option<RestartFrameMode>,
}

/// The values `mode` accepts on `restartFrame`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum RestartFrameMode {
    /// `StepInto`
    StepInto,
    /// 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),
}

/// What `Debugger.restartFrame` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RestartFrameReturns {
    /// New stack trace.
    ///
    /// Deprecated in the protocol.
    #[serde(rename = "callFrames")]
    pub call_frames: Vec<CallFrame>,
    /// Async stack trace, if any.
    ///
    /// Deprecated in the protocol.
    #[serde(
        rename = "asyncStackTrace",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub async_stack_trace: Option<crate::protocol::runtime::StackTrace>,
    /// Async stack trace, if any.
    ///
    /// Deprecated in the protocol.
    #[serde(
        rename = "asyncStackTraceId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub async_stack_trace_id: Option<crate::protocol::runtime::StackTraceId>,
}

impl crate::typed::Command for RestartFrameParams {
    const METHOD: &'static str = "Debugger.restartFrame";
    type Returns = RestartFrameReturns;
}

/// Resumes JavaScript execution.
///
/// Parameters of `Debugger.resume`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ResumeParams {
    /// Set to true to terminate execution upon resuming execution. In contrast to
    /// Runtime.terminateExecution, this will allows to execute further JavaScript
    /// (i.e. via evaluation) until execution of the paused code is actually
    /// resumed, at which point termination is triggered. If execution is
    /// currently not paused, this parameter has no effect.
    #[serde(
        rename = "terminateOnResume",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub terminate_on_resume: Option<bool>,
}

impl crate::typed::Command for ResumeParams {
    const METHOD: &'static str = "Debugger.resume";
    type Returns = crate::typed::NoReturns;
}

/// Searches for given string in script content.
///
/// Parameters of `Debugger.searchInContent`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SearchInContentParams {
    /// Id of the script to search in.
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
    /// String to search for.
    pub query: String,
    /// If true, search is case sensitive.
    #[serde(
        rename = "caseSensitive",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub case_sensitive: Option<bool>,
    /// If true, treats string parameter as regex.
    #[serde(rename = "isRegex", default, skip_serializing_if = "Option::is_none")]
    pub is_regex: Option<bool>,
}

/// What `Debugger.searchInContent` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SearchInContentReturns {
    /// List of search matches.
    pub result: Vec<SearchMatch>,
}

impl crate::typed::Command for SearchInContentParams {
    const METHOD: &'static str = "Debugger.searchInContent";
    type Returns = SearchInContentReturns;
}

/// Enables or disables async call stacks tracking.
///
/// Parameters of `Debugger.setAsyncCallStackDepth`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetAsyncCallStackDepthParams {
    /// Maximum depth of async call stacks. Setting to `0` will effectively
    /// disable collecting async call stacks (default).
    #[serde(rename = "maxDepth")]
    pub max_depth: i64,
}

impl crate::typed::Command for SetAsyncCallStackDepthParams {
    const METHOD: &'static str = "Debugger.setAsyncCallStackDepth";
    type Returns = crate::typed::NoReturns;
}

/// Replace previous blackbox execution contexts with passed ones. Forces
/// backend to skip stepping/pausing in scripts in these execution contexts.
/// VM will try to leave blackboxed script by performing 'step in' several
/// times, finally resorting to 'step out' if unsuccessful.
///
/// Experimental: may change without notice.
///
/// Parameters of `Debugger.setBlackboxExecutionContexts`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBlackboxExecutionContextsParams {
    /// Array of execution context unique ids for the debugger to ignore.
    #[serde(rename = "uniqueIds")]
    pub unique_ids: Vec<String>,
}

impl crate::typed::Command for SetBlackboxExecutionContextsParams {
    const METHOD: &'static str = "Debugger.setBlackboxExecutionContexts";
    type Returns = crate::typed::NoReturns;
}

/// Replace previous blackbox patterns with passed ones. Forces backend to
/// skip stepping/pausing in scripts with url matching one of the patterns. VM
/// will try to leave blackboxed script by performing 'step in' several times,
/// finally resorting to 'step out' if unsuccessful.
///
/// Experimental: may change without notice.
///
/// Parameters of `Debugger.setBlackboxPatterns`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBlackboxPatternsParams {
    /// Array of regexps that will be used to check script url for blackbox state.
    pub patterns: Vec<String>,
    /// If true, also ignore scripts with no source url.
    #[serde(
        rename = "skipAnonymous",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub skip_anonymous: Option<bool>,
}

impl crate::typed::Command for SetBlackboxPatternsParams {
    const METHOD: &'static str = "Debugger.setBlackboxPatterns";
    type Returns = crate::typed::NoReturns;
}

/// Makes backend skip steps in the script in blackboxed ranges. VM will try
/// leave blacklisted scripts by performing 'step in' several times, finally
/// resorting to 'step out' if unsuccessful. Positions array contains
/// positions where blackbox state is changed. First interval isn't
/// blackboxed. Array should be sorted.
///
/// Experimental: may change without notice.
///
/// Parameters of `Debugger.setBlackboxedRanges`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBlackboxedRangesParams {
    /// Id of the script.
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
    pub positions: Vec<ScriptPosition>,
}

impl crate::typed::Command for SetBlackboxedRangesParams {
    const METHOD: &'static str = "Debugger.setBlackboxedRanges";
    type Returns = crate::typed::NoReturns;
}

/// Sets JavaScript breakpoint at a given location.
///
/// Parameters of `Debugger.setBreakpoint`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBreakpointParams {
    /// Location to set breakpoint in.
    pub location: Location,
    /// Expression to use as a breakpoint condition. When specified, debugger will
    /// only stop on the breakpoint if this expression evaluates to true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub condition: Option<String>,
}

/// What `Debugger.setBreakpoint` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBreakpointReturns {
    /// Id of the created breakpoint for further reference.
    #[serde(rename = "breakpointId")]
    pub breakpoint_id: BreakpointId,
    /// Location this breakpoint resolved into.
    #[serde(rename = "actualLocation")]
    pub actual_location: Location,
}

impl crate::typed::Command for SetBreakpointParams {
    const METHOD: &'static str = "Debugger.setBreakpoint";
    type Returns = SetBreakpointReturns;
}

/// Sets instrumentation breakpoint.
///
/// Parameters of `Debugger.setInstrumentationBreakpoint`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetInstrumentationBreakpointParams {
    /// Instrumentation name.
    pub instrumentation: SetInstrumentationBreakpointInstrumentation,
}

/// The values `instrumentation` accepts on `setInstrumentationBreakpoint`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetInstrumentationBreakpointInstrumentation {
    /// `beforeScriptExecution`
    #[serde(rename = "beforeScriptExecution")]
    BeforeScriptExecution,
    /// `beforeScriptWithSourceMapExecution`
    #[serde(rename = "beforeScriptWithSourceMapExecution")]
    BeforeScriptWithSourceMapExecution,
    /// 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),
}

/// What `Debugger.setInstrumentationBreakpoint` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetInstrumentationBreakpointReturns {
    /// Id of the created breakpoint for further reference.
    #[serde(rename = "breakpointId")]
    pub breakpoint_id: BreakpointId,
}

impl crate::typed::Command for SetInstrumentationBreakpointParams {
    const METHOD: &'static str = "Debugger.setInstrumentationBreakpoint";
    type Returns = SetInstrumentationBreakpointReturns;
}

/// Sets JavaScript breakpoint at given location specified either by URL or
/// URL regex. Once this command is issued, all existing parsed scripts will
/// have breakpoints resolved and returned in `locations` property. Further
/// matching script parsing will result in subsequent `breakpointResolved`
/// events issued. This logical breakpoint will survive page reloads.
///
/// Parameters of `Debugger.setBreakpointByUrl`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBreakpointByUrlParams {
    /// Line number to set breakpoint at.
    #[serde(rename = "lineNumber")]
    pub line_number: i64,
    /// URL of the resources to set breakpoint on.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    /// Regex pattern for the URLs of the resources to set breakpoints on. Either
    /// `url` or `urlRegex` must be specified.
    #[serde(rename = "urlRegex", default, skip_serializing_if = "Option::is_none")]
    pub url_regex: Option<String>,
    /// Script hash of the resources to set breakpoint on.
    #[serde(
        rename = "scriptHash",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub script_hash: Option<String>,
    /// Offset in the line to set breakpoint at.
    #[serde(
        rename = "columnNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub column_number: Option<i64>,
    /// Expression to use as a breakpoint condition. When specified, debugger will
    /// only stop on the breakpoint if this expression evaluates to true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub condition: Option<String>,
}

/// What `Debugger.setBreakpointByUrl` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBreakpointByUrlReturns {
    /// Id of the created breakpoint for further reference.
    #[serde(rename = "breakpointId")]
    pub breakpoint_id: BreakpointId,
    /// List of the locations this breakpoint resolved into upon addition.
    pub locations: Vec<Location>,
}

impl crate::typed::Command for SetBreakpointByUrlParams {
    const METHOD: &'static str = "Debugger.setBreakpointByUrl";
    type Returns = SetBreakpointByUrlReturns;
}

/// Sets JavaScript breakpoint before each call to the given function. If
/// another function was created from the same source as a given one, calling
/// it will also trigger the breakpoint.
///
/// Experimental: may change without notice.
///
/// Parameters of `Debugger.setBreakpointOnFunctionCall`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBreakpointOnFunctionCallParams {
    /// Function object id.
    #[serde(rename = "objectId")]
    pub object_id: crate::protocol::runtime::RemoteObjectId,
    /// Expression to use as a breakpoint condition. When specified, debugger will
    /// stop on the breakpoint if this expression evaluates to true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub condition: Option<String>,
}

/// What `Debugger.setBreakpointOnFunctionCall` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBreakpointOnFunctionCallReturns {
    /// Id of the created breakpoint for further reference.
    #[serde(rename = "breakpointId")]
    pub breakpoint_id: BreakpointId,
}

impl crate::typed::Command for SetBreakpointOnFunctionCallParams {
    const METHOD: &'static str = "Debugger.setBreakpointOnFunctionCall";
    type Returns = SetBreakpointOnFunctionCallReturns;
}

/// Activates / deactivates all breakpoints on the page.
///
/// Parameters of `Debugger.setBreakpointsActive`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetBreakpointsActiveParams {
    /// New value for breakpoints active state.
    pub active: bool,
}

impl crate::typed::Command for SetBreakpointsActiveParams {
    const METHOD: &'static str = "Debugger.setBreakpointsActive";
    type Returns = crate::typed::NoReturns;
}

/// Defines pause on exceptions state. Can be set to stop on all exceptions,
/// uncaught exceptions, or caught exceptions, no exceptions. Initial pause on
/// exceptions state is `none`.
///
/// Parameters of `Debugger.setPauseOnExceptions`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetPauseOnExceptionsParams {
    /// Pause on exceptions mode.
    pub state: SetPauseOnExceptionsState,
}

/// The values `state` accepts on `setPauseOnExceptions`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetPauseOnExceptionsState {
    /// `none`
    #[serde(rename = "none")]
    None,
    /// `caught`
    #[serde(rename = "caught")]
    Caught,
    /// `uncaught`
    #[serde(rename = "uncaught")]
    Uncaught,
    /// `all`
    #[serde(rename = "all")]
    All,
    /// 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 SetPauseOnExceptionsParams {
    const METHOD: &'static str = "Debugger.setPauseOnExceptions";
    type Returns = crate::typed::NoReturns;
}

/// Changes return value in top frame. Available only at return break
/// position.
///
/// Experimental: may change without notice.
///
/// Parameters of `Debugger.setReturnValue`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetReturnValueParams {
    /// New return value.
    #[serde(rename = "newValue")]
    pub new_value: crate::protocol::runtime::CallArgument,
}

impl crate::typed::Command for SetReturnValueParams {
    const METHOD: &'static str = "Debugger.setReturnValue";
    type Returns = crate::typed::NoReturns;
}

/// Live edit is no longer supported and this command always fails with a "no
/// longer available" error.
///
/// Deprecated in the protocol.
///
/// Parameters of `Debugger.setScriptSource`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetScriptSourceParams {
    /// Id of the script to edit.
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
    /// New content of the script.
    #[serde(rename = "scriptSource")]
    pub script_source: String,
    /// If true the change will not actually be applied. Dry run may be used to
    /// get result description without actually modifying the code.
    #[serde(rename = "dryRun", default, skip_serializing_if = "Option::is_none")]
    pub dry_run: Option<bool>,
    /// If true, then `scriptSource` is allowed to change the function on top of
    /// the stack as long as the top-most stack frame is the only activation of
    /// that function.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "allowTopFrameEditing",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub allow_top_frame_editing: Option<bool>,
}

/// What `Debugger.setScriptSource` answers with.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetScriptSourceReturns {
    /// New stack trace in case editing has happened while VM was stopped.
    ///
    /// Deprecated in the protocol.
    #[serde(
        rename = "callFrames",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub call_frames: Option<Vec<CallFrame>>,
    /// Whether current call stack was modified after applying the changes.
    ///
    /// Deprecated in the protocol.
    #[serde(
        rename = "stackChanged",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub stack_changed: Option<bool>,
    /// Async stack trace, if any.
    ///
    /// Deprecated in the protocol.
    #[serde(
        rename = "asyncStackTrace",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub async_stack_trace: Option<crate::protocol::runtime::StackTrace>,
    /// Async stack trace, if any.
    ///
    /// Deprecated in the protocol.
    #[serde(
        rename = "asyncStackTraceId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub async_stack_trace_id: Option<crate::protocol::runtime::StackTraceId>,
    /// Whether the operation was successful or not. Only `Ok` denotes a
    /// successful live edit while the other enum variants denote why the live
    /// edit failed.
    ///
    /// Experimental: may change without notice.
    pub status: SetScriptSourceStatus,
    /// Exception details if any. Only present when `status` is `CompileError`.
    #[serde(
        rename = "exceptionDetails",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub exception_details: Option<crate::protocol::runtime::ExceptionDetails>,
}

/// The values `status` accepts on `setScriptSource`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetScriptSourceStatus {
    /// `Ok`
    Ok,
    /// `CompileError`
    CompileError,
    /// `BlockedByActiveGenerator`
    BlockedByActiveGenerator,
    /// `BlockedByActiveFunction`
    BlockedByActiveFunction,
    /// `BlockedByTopLevelEsModuleChange`
    BlockedByTopLevelEsModuleChange,
    /// 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 SetScriptSourceParams {
    const METHOD: &'static str = "Debugger.setScriptSource";
    type Returns = SetScriptSourceReturns;
}

/// Makes page not interrupt on any pauses (breakpoint, exception, dom
/// exception etc).
///
/// Parameters of `Debugger.setSkipAllPauses`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetSkipAllPausesParams {
    /// New value for skip pauses state.
    pub skip: bool,
}

impl crate::typed::Command for SetSkipAllPausesParams {
    const METHOD: &'static str = "Debugger.setSkipAllPauses";
    type Returns = crate::typed::NoReturns;
}

/// Changes value of variable in a callframe. Object-based scopes are not
/// supported and must be mutated manually.
///
/// Parameters of `Debugger.setVariableValue`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetVariableValueParams {
    /// 0-based number of scope as was listed in scope chain. Only 'local',
    /// 'closure' and 'catch' scope types are allowed. Other scopes could be
    /// manipulated manually.
    #[serde(rename = "scopeNumber")]
    pub scope_number: i64,
    /// Variable name.
    #[serde(rename = "variableName")]
    pub variable_name: String,
    /// New variable value.
    #[serde(rename = "newValue")]
    pub new_value: crate::protocol::runtime::CallArgument,
    /// Id of callframe that holds variable.
    #[serde(rename = "callFrameId")]
    pub call_frame_id: CallFrameId,
}

impl crate::typed::Command for SetVariableValueParams {
    const METHOD: &'static str = "Debugger.setVariableValue";
    type Returns = crate::typed::NoReturns;
}

/// Steps into the function call.
///
/// Parameters of `Debugger.stepInto`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct StepIntoParams {
    /// Debugger will pause on the execution of the first async task which was
    /// scheduled before next pause.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "breakOnAsyncCall",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub break_on_async_call: Option<bool>,
    /// The skipList specifies location ranges that should be skipped on step
    /// into.
    ///
    /// Experimental: may change without notice.
    #[serde(rename = "skipList", default, skip_serializing_if = "Option::is_none")]
    pub skip_list: Option<Vec<LocationRange>>,
}

impl crate::typed::Command for StepIntoParams {
    const METHOD: &'static str = "Debugger.stepInto";
    type Returns = crate::typed::NoReturns;
}

/// Steps out of the function call.
///
/// Parameters of `Debugger.stepOut`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct StepOutParams {}

impl crate::typed::Command for StepOutParams {
    const METHOD: &'static str = "Debugger.stepOut";
    type Returns = crate::typed::NoReturns;
}

/// Steps over the statement.
///
/// Parameters of `Debugger.stepOver`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct StepOverParams {
    /// The skipList specifies location ranges that should be skipped on step
    /// over.
    ///
    /// Experimental: may change without notice.
    #[serde(rename = "skipList", default, skip_serializing_if = "Option::is_none")]
    pub skip_list: Option<Vec<LocationRange>>,
    /// Functions whose source range lies within one of the enterRanges are
    /// entered as if by stepInto, even when they are called (directly or
    /// indirectly) from a call that is stepped over.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "enterRanges",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub enter_ranges: Option<Vec<LocationRange>>,
}

impl crate::typed::Command for StepOverParams {
    const METHOD: &'static str = "Debugger.stepOver";
    type Returns = crate::typed::NoReturns;
}

/// Fired when breakpoint is resolved to an actual script and location.
/// Deprecated in favor of `resolvedBreakpoints` in the `scriptParsed` event.
///
/// Deprecated in the protocol.
///
/// Payload of the `Debugger.breakpointResolved` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct BreakpointResolvedEvent {
    /// Breakpoint unique identifier.
    #[serde(rename = "breakpointId")]
    pub breakpoint_id: BreakpointId,
    /// Actual breakpoint location.
    pub location: Location,
}

impl crate::typed::Event for BreakpointResolvedEvent {
    const METHOD: &'static str = "Debugger.breakpointResolved";
}

/// Fired when the virtual machine stopped on breakpoint or exception or any
/// other stop criteria.
///
/// Payload of the `Debugger.paused` event.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PausedEvent {
    /// Call stack the virtual machine stopped on.
    #[serde(rename = "callFrames")]
    pub call_frames: Vec<CallFrame>,
    /// Pause reason.
    pub reason: PausedReason,
    /// Object containing break-specific auxiliary properties.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub data: Option<serde_json::Value>,
    /// Hit breakpoints IDs
    #[serde(
        rename = "hitBreakpoints",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub hit_breakpoints: Option<Vec<String>>,
    /// Async stack trace, if any.
    #[serde(
        rename = "asyncStackTrace",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub async_stack_trace: Option<crate::protocol::runtime::StackTrace>,
    /// Async stack trace, if any.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "asyncStackTraceId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub async_stack_trace_id: Option<crate::protocol::runtime::StackTraceId>,
    /// Never present, will be removed.
    ///
    /// Deprecated in the protocol.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "asyncCallStackTraceId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub async_call_stack_trace_id: Option<crate::protocol::runtime::StackTraceId>,
}

/// The values `reason` accepts on `paused`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PausedReason {
    /// `ambiguous`
    #[serde(rename = "ambiguous")]
    Ambiguous,
    /// `assert`
    #[serde(rename = "assert")]
    Assert,
    /// `CSPViolation`
    #[serde(rename = "CSPViolation")]
    CspViolation,
    /// `debugCommand`
    #[serde(rename = "debugCommand")]
    DebugCommand,
    /// `DOM`
    #[serde(rename = "DOM")]
    Dom,
    /// `EventListener`
    EventListener,
    /// `exception`
    #[serde(rename = "exception")]
    Exception,
    /// `instrumentation`
    #[serde(rename = "instrumentation")]
    Instrumentation,
    /// `OOM`
    #[serde(rename = "OOM")]
    Oom,
    /// `other`
    #[serde(rename = "other")]
    Other,
    /// `promiseRejection`
    #[serde(rename = "promiseRejection")]
    PromiseRejection,
    /// `XHR`
    #[serde(rename = "XHR")]
    Xhr,
    /// `step`
    #[serde(rename = "step")]
    Step,
    /// 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::Event for PausedEvent {
    const METHOD: &'static str = "Debugger.paused";
}

/// Fired when the virtual machine resumed execution.
///
/// Payload of the `Debugger.resumed` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ResumedEvent {}

impl crate::typed::Event for ResumedEvent {
    const METHOD: &'static str = "Debugger.resumed";
}

/// Fired when virtual machine fails to parse the script.
///
/// Payload of the `Debugger.scriptFailedToParse` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ScriptFailedToParseEvent {
    /// Identifier of the script parsed.
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
    /// URL or name of the script parsed (if any).
    pub url: String,
    /// Line offset of the script within the resource with given URL (for script
    /// tags).
    #[serde(rename = "startLine")]
    pub start_line: i64,
    /// Column offset of the script within the resource with given URL.
    #[serde(rename = "startColumn")]
    pub start_column: i64,
    /// Last line of the script.
    #[serde(rename = "endLine")]
    pub end_line: i64,
    /// Length of the last line of the script.
    #[serde(rename = "endColumn")]
    pub end_column: i64,
    /// Specifies script creation context.
    #[serde(rename = "executionContextId")]
    pub execution_context_id: crate::protocol::runtime::ExecutionContextId,
    /// Content hash of the script, SHA-256.
    pub hash: String,
    /// For Wasm modules, the content of the `build_id` custom section. For
    /// JavaScript the `debugId` magic comment.
    #[serde(rename = "buildId")]
    pub build_id: String,
    /// Embedder-specific auxiliary data likely matching {isDefault: boolean,
    /// type: 'default'|'isolated'|'worker', frameId: string}
    #[serde(
        rename = "executionContextAuxData",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub execution_context_aux_data: Option<serde_json::Value>,
    /// URL of source map associated with script (if any).
    #[serde(
        rename = "sourceMapURL",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub source_map_url: Option<String>,
    /// True, if this script has sourceURL.
    #[serde(
        rename = "hasSourceURL",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_source_url: Option<bool>,
    /// True, if this script is ES6 module.
    #[serde(rename = "isModule", default, skip_serializing_if = "Option::is_none")]
    pub is_module: Option<bool>,
    /// This script length.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub length: Option<i64>,
    /// JavaScript top stack frame of where the script parsed event was triggered
    /// if available.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "stackTrace",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub stack_trace: Option<crate::protocol::runtime::StackTrace>,
    /// If the scriptLanguage is WebAssembly, the code section offset in the
    /// module.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "codeOffset",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub code_offset: Option<i64>,
    /// The language of the script.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "scriptLanguage",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub script_language: Option<ScriptLanguage>,
    /// The name the embedder supplied for this script.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "embedderName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub embedder_name: Option<String>,
}

impl crate::typed::Event for ScriptFailedToParseEvent {
    const METHOD: &'static str = "Debugger.scriptFailedToParse";
}

/// Fired when virtual machine parses script. This event is also fired for all
/// known and uncollected scripts upon enabling debugger.
///
/// Payload of the `Debugger.scriptParsed` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ScriptParsedEvent {
    /// Identifier of the script parsed.
    #[serde(rename = "scriptId")]
    pub script_id: crate::protocol::runtime::ScriptId,
    /// URL or name of the script parsed (if any).
    pub url: String,
    /// Line offset of the script within the resource with given URL (for script
    /// tags).
    #[serde(rename = "startLine")]
    pub start_line: i64,
    /// Column offset of the script within the resource with given URL.
    #[serde(rename = "startColumn")]
    pub start_column: i64,
    /// Last line of the script.
    #[serde(rename = "endLine")]
    pub end_line: i64,
    /// Length of the last line of the script.
    #[serde(rename = "endColumn")]
    pub end_column: i64,
    /// Specifies script creation context.
    #[serde(rename = "executionContextId")]
    pub execution_context_id: crate::protocol::runtime::ExecutionContextId,
    /// Content hash of the script, SHA-256.
    pub hash: String,
    /// For Wasm modules, the content of the `build_id` custom section. For
    /// JavaScript the `debugId` magic comment.
    #[serde(rename = "buildId")]
    pub build_id: String,
    /// Embedder-specific auxiliary data likely matching {isDefault: boolean,
    /// type: 'default'|'isolated'|'worker', frameId: string}
    #[serde(
        rename = "executionContextAuxData",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub execution_context_aux_data: Option<serde_json::Value>,
    /// True, if this script is generated as a result of the live edit operation.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "isLiveEdit",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_live_edit: Option<bool>,
    /// URL of source map associated with script (if any).
    #[serde(
        rename = "sourceMapURL",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub source_map_url: Option<String>,
    /// True, if this script has sourceURL.
    #[serde(
        rename = "hasSourceURL",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_source_url: Option<bool>,
    /// True, if this script is ES6 module.
    #[serde(rename = "isModule", default, skip_serializing_if = "Option::is_none")]
    pub is_module: Option<bool>,
    /// This script length.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub length: Option<i64>,
    /// JavaScript top stack frame of where the script parsed event was triggered
    /// if available.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "stackTrace",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub stack_trace: Option<crate::protocol::runtime::StackTrace>,
    /// If the scriptLanguage is WebAssembly, the code section offset in the
    /// module.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "codeOffset",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub code_offset: Option<i64>,
    /// The language of the script.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "scriptLanguage",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub script_language: Option<ScriptLanguage>,
    /// If the scriptLanguage is WebAssembly, the source of debug symbols for the
    /// module.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "debugSymbols",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub debug_symbols: Option<Vec<DebugSymbols>>,
    /// The name the embedder supplied for this script.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "embedderName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub embedder_name: Option<String>,
    /// The list of set breakpoints in this script if calls to
    /// `setBreakpointByUrl` matches this script's URL or hash. Clients that use
    /// this list can ignore the `breakpointResolved` event. They are equivalent.
    ///
    /// Experimental: may change without notice.
    #[serde(
        rename = "resolvedBreakpoints",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub resolved_breakpoints: Option<Vec<ResolvedBreakpoint>>,
}

impl crate::typed::Event for ScriptParsedEvent {
    const METHOD: &'static str = "Debugger.scriptParsed";
}