dapts 0.0.6

Debug Adapter Protocol (DAP) types made easy.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
// This file is autogenerated. Do not edit by hand.
// To regenerate from schema, run `cargo run -p generator`.

use serde::{Deserialize, Serialize};

/// A module identifier.
#[derive(PartialEq, Eq, Debug, Hash, Clone, Deserialize, Serialize)]
#[serde(untagged)]
pub enum ModuleId {
    Number(u32),
    String(String),
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(transparent)]
pub struct AttachRequestArguments {
    pub raw: serde_json::Value,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(transparent)]
pub struct LaunchRequestArguments {
    pub raw: serde_json::Value,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(transparent)]
pub struct RestartArguments {
    pub raw: serde_json::Value,
}

/// Information about a breakpoint created in `setBreakpoints`, `setFunctionBreakpoints`, `setInstructionBreakpoints`, or `setDataBreakpoints` requests.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Breakpoint {
    /// Start position of the source range covered by the breakpoint. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// End position of the source range covered by the breakpoint. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    /// If no end line is given, then the end column is assumed to be in the start line.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_column: Option<u32>,
    /// The end line of the actual range covered by the breakpoint.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_line: Option<u32>,
    /// The identifier for the breakpoint. It is needed if breakpoint events are used to update or remove breakpoints.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<u64>,
    /// A memory reference to where the breakpoint is set.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub instruction_reference: Option<String>,
    /// The start line of the actual range covered by the breakpoint.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub line: Option<u32>,
    /// A message about the state of the breakpoint.
    /// This is shown to the user and can be used to explain why a breakpoint could not be verified.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// The offset from the instruction reference.
    /// This can be negative.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub offset: Option<u32>,
    /// A machine-readable explanation of why a breakpoint may not be verified. If a breakpoint is verified or a specific reason is not known, the adapter should omit this property. Possible values include:
    ///
    /// - `pending`: Indicates a breakpoint might be verified in the future, but the adapter cannot verify it in the current state.
    ///  - `failed`: Indicates a breakpoint was not able to be verified, and the adapter does not believe it can be verified without intervention.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub reason: Option<BreakpointReason>,
    /// The source where the breakpoint is located.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source: Option<Source>,
    /// If true, the breakpoint could be set (but not necessarily at the desired location).
    pub verified: bool,
}

/// A machine-readable explanation of why a breakpoint may not be verified. If a breakpoint is verified or a specific reason is not known, the adapter should omit this property. Possible values include:
///
/// - `pending`: Indicates a breakpoint might be verified in the future, but the adapter cannot verify it in the current state.
///  - `failed`: Indicates a breakpoint was not able to be verified, and the adapter does not believe it can be verified without intervention.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum BreakpointReason {
    Pending,
    Failed,
}

/// The event indicates that some information about a breakpoint has changed.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BreakpointEvent {
    /// The `id` attribute is used to find the target breakpoint, the other attributes are used as the new values.
    pub breakpoint: Breakpoint,
    /// The reason for the event.
    pub reason: BreakpointEventReason,
}

/// The reason for the event.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum BreakpointEventReason {
    Changed,
    New,
    Removed,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Properties of a breakpoint location returned from the `breakpointLocations` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BreakpointLocation {
    /// The start position of a breakpoint location. Position is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// The end position of a breakpoint location (if the location covers a range). Position is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_column: Option<u32>,
    /// The end line of breakpoint location if the location covers a range.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_line: Option<u32>,
    /// Start line of breakpoint location.
    pub line: u32,
}

/// Arguments for `breakpointLocations` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BreakpointLocationsArguments {
    /// Start position within `line` to search possible breakpoint locations in. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If no column is given, the first position in the start line is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// End position within `endLine` to search possible breakpoint locations in. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If no end column is given, the last position in the end line is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_column: Option<u32>,
    /// End line of range to search possible breakpoint locations in. If no end line is given, then the end line is assumed to be the start line.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_line: Option<u32>,
    /// Start line of range to search possible breakpoint locations in. If only the line is specified, the request returns all possible locations in that line.
    pub line: u32,
    /// The source location of the breakpoints; either `source.path` or `source.sourceReference` must be specified.
    pub source: Source,
}

/// Response to `breakpointLocations` request.
/// Contains possible locations for source breakpoints.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BreakpointLocationsResponse {
    /// Sorted set of possible breakpoint locations.
    pub breakpoints: Vec<BreakpointLocation>,
}

/// A `BreakpointMode` is provided as a option when setting breakpoints on sources or instructions.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct BreakpointMode {
    /// Describes one or more type of breakpoint this mode applies to.
    pub applies_to: Vec<BreakpointModeApplicability>,
    /// A help text providing additional information about the breakpoint mode. This string is typically shown as a hover and can be translated.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// The name of the breakpoint mode. This is shown in the UI.
    pub label: String,
    /// The internal ID of the mode. This value is passed to the `setBreakpoints` request.
    pub mode: String,
}

/// Describes one or more type of breakpoint a `BreakpointMode` applies to. This is a non-exhaustive enumeration and may expand as future breakpoint types are added.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum BreakpointModeApplicability {
    /// In `SourceBreakpoint`s
    Source,
    /// In exception breakpoints applied in the `ExceptionFilterOptions`
    Exception,
    /// In data breakpoints requested in the `DataBreakpointInfo` request
    Data,
    /// In `InstructionBreakpoint`s
    Instruction,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Arguments for `cancel` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CancelArguments {
    /// The ID (attribute `progressId`) of the progress to cancel. If missing no progress is cancelled.
    /// Both a `requestId` and a `progressId` can be specified in one request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub progress_id: Option<String>,
    /// The ID (attribute `seq`) of the request to cancel. If missing no request is cancelled.
    /// Both a `requestId` and a `progressId` can be specified in one request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub request_id: Option<u64>,
}

/// Information about the capabilities of a debug adapter.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Capabilities {
    /// The set of additional module information exposed by the debug adapter.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub additional_module_columns: Option<Vec<ColumnDescriptor>>,
    /// Modes of breakpoints supported by the debug adapter, such as 'hardware' or 'software'. If present, the client may allow the user to select a mode and include it in its `setBreakpoints` request.
    ///
    /// Clients may present the first applicable mode in this array as the 'default' mode in gestures that set breakpoints.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub breakpoint_modes: Option<Vec<BreakpointMode>>,
    /// The set of characters that should trigger completion in a REPL. If not specified, the UI should assume the `.` character.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub completion_trigger_characters: Option<Vec<String>>,
    /// Available exception filter options for the `setExceptionBreakpoints` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exception_breakpoint_filters: Option<Vec<ExceptionBreakpointsFilter>>,
    /// The debug adapter supports the `suspendDebuggee` attribute on the `disconnect` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub support_suspend_debuggee: Option<bool>,
    /// The debug adapter supports the `terminateDebuggee` attribute on the `disconnect` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub support_terminate_debuggee: Option<bool>,
    /// Checksum algorithms supported by the debug adapter.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supported_checksum_algorithms: Option<Vec<ChecksumAlgorithm>>,
    /// The debug adapter supports ANSI escape sequences in styling of `OutputEvent.output` and `Variable.value` fields.
    #[serde(rename = "supportsANSIStyling")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_ansistyling: Option<bool>,
    /// The debug adapter supports the `breakpointLocations` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_breakpoint_locations_request: Option<bool>,
    /// The debug adapter supports the `cancel` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_cancel_request: Option<bool>,
    /// The debug adapter supports the `clipboard` context value in the `evaluate` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_clipboard_context: Option<bool>,
    /// The debug adapter supports the `completions` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_completions_request: Option<bool>,
    /// The debug adapter supports conditional breakpoints.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_conditional_breakpoints: Option<bool>,
    /// The debug adapter supports the `configurationDone` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_configuration_done_request: Option<bool>,
    /// The debug adapter supports the `asAddress` and `bytes` fields in the `dataBreakpointInfo` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_data_breakpoint_bytes: Option<bool>,
    /// The debug adapter supports data breakpoints.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_data_breakpoints: Option<bool>,
    /// The debug adapter supports the delayed loading of parts of the stack, which requires that both the `startFrame` and `levels` arguments and the `totalFrames` result of the `stackTrace` request are supported.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_delayed_stack_trace_loading: Option<bool>,
    /// The debug adapter supports the `disassemble` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_disassemble_request: Option<bool>,
    /// The debug adapter supports a (side effect free) `evaluate` request for data hovers.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_evaluate_for_hovers: Option<bool>,
    /// The debug adapter supports `filterOptions` as an argument on the `setExceptionBreakpoints` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_exception_filter_options: Option<bool>,
    /// The debug adapter supports the `exceptionInfo` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_exception_info_request: Option<bool>,
    /// The debug adapter supports `exceptionOptions` on the `setExceptionBreakpoints` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_exception_options: Option<bool>,
    /// The debug adapter supports function breakpoints.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_function_breakpoints: Option<bool>,
    /// The debug adapter supports the `gotoTargets` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_goto_targets_request: Option<bool>,
    /// The debug adapter supports breakpoints that break execution after a specified number of hits.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_hit_conditional_breakpoints: Option<bool>,
    /// The debug adapter supports adding breakpoints based on instruction references.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_instruction_breakpoints: Option<bool>,
    /// The debug adapter supports the `loadedSources` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_loaded_sources_request: Option<bool>,
    /// The debug adapter supports log points by interpreting the `logMessage` attribute of the `SourceBreakpoint`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_log_points: Option<bool>,
    /// The debug adapter supports the `modules` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_modules_request: Option<bool>,
    /// The debug adapter supports the `readMemory` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_read_memory_request: Option<bool>,
    /// The debug adapter supports restarting a frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_restart_frame: Option<bool>,
    /// The debug adapter supports the `restart` request. In this case a client should not implement `restart` by terminating and relaunching the adapter but by calling the `restart` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_restart_request: Option<bool>,
    /// The debug adapter supports the `setExpression` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_set_expression: Option<bool>,
    /// The debug adapter supports setting a variable to a value.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_set_variable: Option<bool>,
    /// The debug adapter supports the `singleThread` property on the execution requests (`continue`, `next`, `stepIn`, `stepOut`, `reverseContinue`, `stepBack`).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_single_thread_execution_requests: Option<bool>,
    /// The debug adapter supports stepping back via the `stepBack` and `reverseContinue` requests.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_step_back: Option<bool>,
    /// The debug adapter supports the `stepInTargets` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_step_in_targets_request: Option<bool>,
    /// The debug adapter supports stepping granularities (argument `granularity`) for the stepping requests.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_stepping_granularity: Option<bool>,
    /// The debug adapter supports the `terminate` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_terminate_request: Option<bool>,
    /// The debug adapter supports the `terminateThreads` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_terminate_threads_request: Option<bool>,
    /// The debug adapter supports a `format` attribute on the `stackTrace`, `variables`, and `evaluate` requests.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_value_formatting_options: Option<bool>,
    /// The debug adapter supports the `writeMemory` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_write_memory_request: Option<bool>,
}

/// The event indicates that one or more capabilities have changed.
/// Since the capabilities are dependent on the client and its UI, it might not be possible to change that at random times (or too late).
/// Consequently this event has a hint characteristic: a client can only be expected to make a 'best effort' in honoring individual capabilities but there are no guarantees.
/// Only changed capabilities need to be included, all other capabilities keep their values.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CapabilitiesEvent {
    /// The set of updated capabilities.
    pub capabilities: Capabilities,
}

/// The checksum of an item calculated by the specified algorithm.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Checksum {
    /// The algorithm used to calculate this checksum.
    pub algorithm: ChecksumAlgorithm,
    /// Value of the checksum, encoded as a hexadecimal value.
    pub checksum: String,
}

/// Names of checksum algorithms that may be supported by a debug adapter.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum ChecksumAlgorithm {
    #[serde(rename = "MD5")]
    Md5,
    #[serde(rename = "SHA1")]
    Sha1,
    #[serde(rename = "SHA256")]
    Sha256,
    Timestamp,
}

/// A `ColumnDescriptor` specifies what module attribute to show in a column of the modules view, how to format it,
/// and what the column's label should be.
/// It is only used if the underlying UI actually supports this level of customization.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ColumnDescriptor {
    /// Name of the attribute rendered in this column.
    pub attribute_name: String,
    /// Format to use for the rendered values in this column. TBD how the format strings looks like.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub format: Option<String>,
    /// Header UI label of column.
    pub label: String,
    /// Datatype of values in this column. Defaults to `string` if not specified.
    #[serde(rename = "type")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ty: Option<ColumnDescriptorType>,
    /// Width of this column in characters (hint only).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub width: Option<u64>,
}

/// Datatype of values in this column. Defaults to `string` if not specified.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum ColumnDescriptorType {
    String,
    Number,
    Boolean,
    #[serde(rename = "unixTimestampUTC")]
    UnixTimestampUtc,
}

/// `CompletionItems` are the suggestions returned from the `completions` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CompletionItem {
    /// A human-readable string with additional information about this item, like type or symbol information.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub detail: Option<String>,
    /// The label of this completion item. By default this is also the text that is inserted when selecting this completion.
    pub label: String,
    /// Length determines how many characters are overwritten by the completion text and it is measured in UTF-16 code units. If missing the value 0 is assumed which results in the completion text being inserted.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub length: Option<u64>,
    /// Determines the length of the new selection after the text has been inserted (or replaced) and it is measured in UTF-16 code units. The selection can not extend beyond the bounds of the completion text. If omitted the length is assumed to be 0.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub selection_length: Option<u64>,
    /// Determines the start of the new selection after the text has been inserted (or replaced). `selectionStart` is measured in UTF-16 code units and must be in the range 0 and length of the completion text. If omitted the selection starts at the end of the completion text.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub selection_start: Option<u64>,
    /// A string that should be used when comparing this item with other items. If not returned or an empty string, the `label` is used instead.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub sort_text: Option<String>,
    /// Start position (within the `text` attribute of the `completions` request) where the completion text is added. The position is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If the start position is omitted the text is added at the location specified by the `column` attribute of the `completions` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub start: Option<u64>,
    /// If text is returned and not an empty string, then it is inserted instead of the label.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub text: Option<String>,
    /// The item's type. Typically the client uses this information to render the item in the UI with an icon.
    #[serde(rename = "type")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ty: Option<CompletionItemType>,
}

/// Some predefined types for the CompletionItem. Please note that not all clients have specific icons for all of them.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum CompletionItemType {
    Method,
    Function,
    Constructor,
    Field,
    Variable,
    Class,
    Interface,
    Module,
    Property,
    Unit,
    Value,
    Enum,
    Keyword,
    Snippet,
    Text,
    Color,
    File,
    Reference,
    Customcolor,
}

/// Arguments for `completions` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CompletionsArguments {
    /// The position within `text` for which to determine the completion proposals. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    pub column: u32,
    /// Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub frame_id: Option<u64>,
    /// A line for which to determine the completion proposals. If missing the first line of the text is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub line: Option<u32>,
    /// One or more source lines. Typically this is the text users have typed into the debug console before they asked for completion.
    pub text: String,
}

/// Response to `completions` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CompletionsResponse {
    /// The possible completions for .
    pub targets: Vec<CompletionItem>,
}

/// Arguments for `configurationDone` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
pub struct ConfigurationDoneArguments;

/// Arguments for `continue` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ContinueArguments {
    /// If this flag is true, execution is resumed only for the thread with given `threadId`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub single_thread: Option<bool>,
    /// Specifies the active thread. If the debug adapter supports single thread execution (see `supportsSingleThreadExecutionRequests`) and the argument `singleThread` is true, only the thread with this ID is resumed.
    pub thread_id: u64,
}

/// Response to `continue` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ContinueResponse {
    /// If omitted or set to `true`, this response signals to the client that all threads have been resumed. The value `false` indicates that not all threads were resumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub all_threads_continued: Option<bool>,
}

/// The event indicates that the execution of the debuggee has continued.
/// Please note: a debug adapter is not expected to send this event in response to a request that implies that execution continues, e.g. `launch` or `continue`.
/// It is only necessary to send a `continued` event if there was no previous request that implied this.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ContinuedEvent {
    /// If omitted or set to `true`, this event signals to the client that all threads have been resumed. The value `false` indicates that not all threads were resumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub all_threads_continued: Option<bool>,
    /// The thread which was continued.
    pub thread_id: u64,
}

/// Properties of a data breakpoint passed to the `setDataBreakpoints` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DataBreakpoint {
    /// The access type of the data.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub access_type: Option<DataBreakpointAccessType>,
    /// An expression for conditional breakpoints.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub condition: Option<String>,
    /// An id representing the data. This id is returned from the `dataBreakpointInfo` request.
    pub data_id: String,
    /// An expression that controls how many hits of the breakpoint are ignored.
    /// The debug adapter is expected to interpret the expression as needed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hit_condition: Option<String>,
}

/// This enumeration defines all possible access types for data breakpoints.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum DataBreakpointAccessType {
    Read,
    Write,
    ReadWrite,
}

/// Arguments for `dataBreakpointInfo` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DataBreakpointInfoArguments {
    /// If `true`, the `name` is a memory address and the debugger should interpret it as a decimal value, or hex value if it is prefixed with `0x`.
    ///
    /// Clients may set this property only if the `supportsDataBreakpointBytes`
    /// capability is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub as_address: Option<bool>,
    /// If specified, a debug adapter should return information for the range of memory extending `bytes` number of bytes from the address or variable specified by `name`. Breakpoints set using the resulting data ID should pause on data access anywhere within that range.
    ///
    /// Clients may set this property only if the `supportsDataBreakpointBytes` capability is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub bytes: Option<u64>,
    /// When `name` is an expression, evaluate it in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. When `variablesReference` is specified, this property has no effect.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub frame_id: Option<u64>,
    /// The mode of the desired breakpoint. If defined, this must be one of the `breakpointModes` the debug adapter advertised in its `Capabilities`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mode: Option<String>,
    /// The name of the variable's child to obtain data breakpoint information for.
    /// If `variablesReference` isn't specified, this can be an expression, or an address if `asAddress` is also true.
    pub name: String,
    /// Reference to the variable container if the data breakpoint is requested for a child of the container. The `variablesReference` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub variables_reference: Option<u32>,
}

/// Response to `dataBreakpointInfo` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DataBreakpointInfoResponse {
    /// Attribute lists the available access types for a potential data breakpoint. A UI client could surface this information.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub access_types: Option<Vec<DataBreakpointAccessType>>,
    /// Attribute indicates that a potential data breakpoint could be persisted across sessions.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub can_persist: Option<bool>,
    /// An identifier for the data on which a data breakpoint can be registered with the `setDataBreakpoints` request or null if no data breakpoint is available. If a `variablesReference` or `frameId` is passed, the `dataId` is valid in the current suspended state, otherwise it's valid indefinitely. See 'Lifetime of Object References' in the Overview section for details. Breakpoints set using the `dataId` in the `setDataBreakpoints` request may outlive the lifetime of the associated `dataId`.
    pub data_id: Option<String>,
    /// UI string that describes on what data the breakpoint is set on or why a data breakpoint is not available.
    pub description: String,
}

/// Arguments for `disassemble` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DisassembleArguments {
    /// Number of instructions to disassemble starting at the specified location and offset.
    /// An adapter must return exactly this number of instructions - any unavailable instructions should be replaced with an implementation-defined 'invalid instruction' value.
    pub instruction_count: u64,
    /// Offset (in instructions) to be applied after the byte offset (if any) before disassembling. Can be negative.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub instruction_offset: Option<u64>,
    /// Memory reference to the base location containing the instructions to disassemble.
    pub memory_reference: String,
    /// Offset (in bytes) to be applied to the reference location before disassembling. Can be negative.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub offset: Option<u32>,
    /// If true, the adapter should attempt to resolve memory addresses and other values to symbolic names.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub resolve_symbols: Option<bool>,
}

/// Response to `disassemble` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DisassembleResponse {
    /// The list of disassembled instructions.
    pub instructions: Vec<DisassembledInstruction>,
}

/// Represents a single disassembled instruction.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DisassembledInstruction {
    /// The address of the instruction. Treated as a hex value if prefixed with `0x`, or as a decimal value otherwise.
    pub address: String,
    /// The column within the line that corresponds to this instruction, if any.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// The end column of the range that corresponds to this instruction, if any.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_column: Option<u32>,
    /// The end line of the range that corresponds to this instruction, if any.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_line: Option<u32>,
    /// Text representing the instruction and its operands, in an implementation-defined format.
    pub instruction: String,
    /// Raw bytes representing the instruction and its operands, in an implementation-defined format.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub instruction_bytes: Option<String>,
    /// The line within the source location that corresponds to this instruction, if any.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub line: Option<u32>,
    /// Source location that corresponds to this instruction, if any.
    /// Should always be set (if available) on the first instruction returned,
    /// but can be omitted afterwards if this instruction maps to the same source file as the previous instruction.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub location: Option<Source>,
    /// A hint for how to present the instruction in the UI.
    ///
    /// A value of `invalid` may be used to indicate this instruction is 'filler' and cannot be reached by the program. For example, unreadable memory addresses may be presented is 'invalid.'
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub presentation_hint: Option<DisassembledInstructionPresentationHint>,
    /// Name of the symbol that corresponds with the location of this instruction, if any.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub symbol: Option<String>,
}

/// A hint for how to present the instruction in the UI.
///
/// A value of `invalid` may be used to indicate this instruction is 'filler' and cannot be reached by the program. For example, unreadable memory addresses may be presented is 'invalid.'
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum DisassembledInstructionPresentationHint {
    Normal,
    Invalid,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Arguments for `disconnect` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DisconnectArguments {
    /// A value of true indicates that this `disconnect` request is part of a restart sequence.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub restart: Option<bool>,
    /// Indicates whether the debuggee should stay suspended when the debugger is disconnected.
    /// If unspecified, the debuggee should resume execution.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportSuspendDebuggee` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub suspend_debuggee: Option<bool>,
    /// Indicates whether the debuggee should be terminated when the debugger is disconnected.
    /// If unspecified, the debug adapter is free to do whatever it thinks is best.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportTerminateDebuggee` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub terminate_debuggee: Option<bool>,
}

/// On error (whenever `success` is false), the body can provide more details.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ErrorResponse {
    /// A structured error message.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub error: Option<Message>,
}

/// Arguments for `evaluate` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct EvaluateArguments {
    /// The contextual column where the expression should be evaluated. This may be provided if `line` is also provided.
    ///
    /// It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// The context in which the evaluate request is used.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub context: Option<EvaluateArgumentsContext>,
    /// The expression to evaluate.
    pub expression: String,
    /// Specifies details on how to format the result.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsValueFormattingOptions` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub format: Option<ValueFormat>,
    /// Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub frame_id: Option<u64>,
    /// The contextual line where the expression should be evaluated. In the 'hover' context, this should be set to the start of the expression being hovered.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub line: Option<u32>,
    /// The contextual source in which the `line` is found. This must be provided if `line` is provided.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source: Option<Source>,
}

/// The context in which the evaluate request is used.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum EvaluateArgumentsContext {
    /// evaluate is called from a watch view context.
    Watch,
    /// evaluate is called from a REPL context.
    Repl,
    /// evaluate is called to generate the debug hover contents.
    /// This value should only be used if the corresponding capability `supportsEvaluateForHovers` is true.
    Hover,
    /// evaluate is called to generate clipboard contents.
    /// This value should only be used if the corresponding capability `supportsClipboardContext` is true.
    Clipboard,
    /// evaluate is called from a variables view context.
    Variables,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Response to `evaluate` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct EvaluateResponse {
    /// The number of indexed child variables.
    /// The client can use this information to present the variables in a paged UI and fetch them in chunks.
    /// The value should be less than or equal to 2147483647 (2^31-1).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub indexed_variables: Option<u32>,
    /// A memory reference to a location appropriate for this result.
    /// For pointer type eval results, this is generally a reference to the memory address contained in the pointer.
    /// This attribute may be returned by a debug adapter if corresponding capability `supportsMemoryReferences` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub memory_reference: Option<String>,
    /// The number of named child variables.
    /// The client can use this information to present the variables in a paged UI and fetch them in chunks.
    /// The value should be less than or equal to 2147483647 (2^31-1).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub named_variables: Option<u32>,
    /// Properties of an evaluate result that can be used to determine how to render the result in the UI.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub presentation_hint: Option<VariablePresentationHint>,
    /// The result of the evaluate request.
    pub result: String,
    /// The type of the evaluate result.
    /// This attribute should only be returned by a debug adapter if the corresponding capability `supportsVariableType` is true.
    #[serde(rename = "type")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ty: Option<String>,
    /// A reference that allows the client to request the location where the returned value is declared. For example, if a function pointer is returned, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location.
    ///
    /// This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub value_location_reference: Option<u64>,
    /// If `variablesReference` is > 0, the evaluate result is structured and its children can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details.
    pub variables_reference: u32,
}

/// This enumeration defines all possible conditions when a thrown exception should result in a break.
/// never: never breaks,
/// always: always breaks,
/// unhandled: breaks when exception unhandled,
/// userUnhandled: breaks if the exception is not handled by user code.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum ExceptionBreakMode {
    Never,
    Always,
    Unhandled,
    UserUnhandled,
}

/// An `ExceptionBreakpointsFilter` is shown in the UI as an filter option for configuring how exceptions are dealt with.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionBreakpointsFilter {
    /// A help text providing information about the condition. This string is shown as the placeholder text for a text box and can be translated.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub condition_description: Option<String>,
    /// Initial value of the filter option. If not specified a value false is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub default: Option<bool>,
    /// A help text providing additional information about the exception filter. This string is typically shown as a hover and can be translated.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// The internal ID of the filter option. This value is passed to the `setExceptionBreakpoints` request.
    pub filter: String,
    /// The name of the filter option. This is shown in the UI.
    pub label: String,
    /// Controls whether a condition can be specified for this filter option. If false or missing, a condition can not be set.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_condition: Option<bool>,
}

/// Detailed information about an exception that has occurred.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionDetails {
    /// An expression that can be evaluated in the current scope to obtain the exception object.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub evaluate_name: Option<String>,
    /// Fully-qualified type name of the exception object.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub full_type_name: Option<String>,
    /// Details of the exception contained by this exception, if any.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub inner_exception: Option<Vec<ExceptionDetails>>,
    /// Message contained in the exception.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// Stack trace at the time the exception was thrown.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub stack_trace: Option<String>,
    /// Short type name of the exception object.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub type_name: Option<String>,
}

/// An `ExceptionFilterOptions` is used to specify an exception filter together with a condition for the `setExceptionBreakpoints` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionFilterOptions {
    /// An expression for conditional exceptions.
    /// The exception breaks into the debugger if the result of the condition is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub condition: Option<String>,
    /// ID of an exception filter returned by the `exceptionBreakpointFilters` capability.
    pub filter_id: String,
    /// The mode of this exception breakpoint. If defined, this must be one of the `breakpointModes` the debug adapter advertised in its `Capabilities`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mode: Option<String>,
}

/// Arguments for `exceptionInfo` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionInfoArguments {
    /// Thread for which exception information should be retrieved.
    pub thread_id: u64,
}

/// Response to `exceptionInfo` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionInfoResponse {
    /// Mode that caused the exception notification to be raised.
    pub break_mode: ExceptionBreakMode,
    /// Descriptive text for the exception.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Detailed information about the exception.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub details: Option<ExceptionDetails>,
    /// ID of the exception that was thrown.
    pub exception_id: String,
}

/// An `ExceptionOptions` assigns configuration options to a set of exceptions.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionOptions {
    /// Condition when a thrown exception should result in a break.
    pub break_mode: ExceptionBreakMode,
    /// A path that selects a single or multiple exceptions in a tree. If `path` is missing, the whole tree is selected.
    /// By convention the first segment of the path is a category that is used to group exceptions in the UI.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub path: Option<Vec<ExceptionPathSegment>>,
}

/// An `ExceptionPathSegment` represents a segment in a path that is used to match leafs or nodes in a tree of exceptions.
/// If a segment consists of more than one name, it matches the names provided if `negate` is false or missing, or it matches anything except the names provided if `negate` is true.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionPathSegment {
    /// Depending on the value of `negate` the names that should match or not match.
    pub names: Vec<String>,
    /// If false or missing this segment matches the names provided, otherwise it matches anything except the names provided.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub negate: Option<bool>,
}

/// The event indicates that the debuggee has exited and returns its exit code.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ExitedEvent {
    /// The exit code returned from the debuggee.
    pub exit_code: u64,
}

/// Properties of a breakpoint passed to the `setFunctionBreakpoints` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct FunctionBreakpoint {
    /// An expression for conditional breakpoints.
    /// It is only honored by a debug adapter if the corresponding capability `supportsConditionalBreakpoints` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub condition: Option<String>,
    /// An expression that controls how many hits of the breakpoint are ignored.
    /// The debug adapter is expected to interpret the expression as needed.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsHitConditionalBreakpoints` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hit_condition: Option<String>,
    /// The name of the function.
    pub name: String,
}

/// Arguments for `goto` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GotoArguments {
    /// The location where the debuggee will continue to run.
    pub target_id: u64,
    /// Set the goto target for this thread.
    pub thread_id: u64,
}

/// A `GotoTarget` describes a code location that can be used as a target in the `goto` request.
/// The possible goto targets can be determined via the `gotoTargets` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GotoTarget {
    /// The column of the goto target.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// The end column of the range covered by the goto target.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_column: Option<u32>,
    /// The end line of the range covered by the goto target.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_line: Option<u32>,
    /// Unique identifier for a goto target. This is used in the `goto` request.
    pub id: u64,
    /// A memory reference for the instruction pointer value represented by this target.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub instruction_pointer_reference: Option<String>,
    /// The name of the goto target (shown in the UI).
    pub label: String,
    /// The line of the goto target.
    pub line: u32,
}

/// Arguments for `gotoTargets` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GotoTargetsArguments {
    /// The position within `line` for which the goto targets are determined. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// The line location for which the goto targets are determined.
    pub line: u32,
    /// The source location for which the goto targets are determined.
    pub source: Source,
}

/// Response to `gotoTargets` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GotoTargetsResponse {
    /// The possible goto targets of the specified location.
    pub targets: Vec<GotoTarget>,
}

/// Arguments for `initialize` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct InitializeRequestArguments {
    /// The ID of the debug adapter.
    #[serde(rename = "adapterID")]
    pub adapter_id: String,
    /// The ID of the client using this adapter.
    #[serde(rename = "clientID")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub client_id: Option<String>,
    /// The human-readable name of the client using this adapter.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub client_name: Option<String>,
    /// If true all column numbers are 1-based (default).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub columns_start_at1: Option<bool>,
    /// If true all line numbers are 1-based (default).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub lines_start_at1: Option<bool>,
    /// The ISO-639 locale of the client using this adapter, e.g. en-US or de-CH.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
    /// Determines in what format paths are specified. The default is `path`, which is the native format.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub path_format: Option<InitializeRequestArgumentsPathFormat>,
    /// The client will interpret ANSI escape sequences in the display of `OutputEvent.output` and `Variable.value` fields when `Capabilities.supportsANSIStyling` is also enabled.
    #[serde(rename = "supportsANSIStyling")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_ansistyling: Option<bool>,
    /// Client supports the `argsCanBeInterpretedByShell` attribute on the `runInTerminal` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_args_can_be_interpreted_by_shell: Option<bool>,
    /// Client supports the `invalidated` event.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_invalidated_event: Option<bool>,
    /// Client supports the `memory` event.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_memory_event: Option<bool>,
    /// Client supports memory references.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_memory_references: Option<bool>,
    /// Client supports progress reporting.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_progress_reporting: Option<bool>,
    /// Client supports the `runInTerminal` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_run_in_terminal_request: Option<bool>,
    /// Client supports the `startDebugging` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_start_debugging_request: Option<bool>,
    /// Client supports the paging of variables.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_variable_paging: Option<bool>,
    /// Client supports the `type` attribute for variables.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub supports_variable_type: Option<bool>,
}

/// Determines in what format paths are specified. The default is `path`, which is the native format.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum InitializeRequestArgumentsPathFormat {
    Path,
    Uri,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Properties of a breakpoint passed to the `setInstructionBreakpoints` request
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct InstructionBreakpoint {
    /// An expression for conditional breakpoints.
    /// It is only honored by a debug adapter if the corresponding capability `supportsConditionalBreakpoints` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub condition: Option<String>,
    /// An expression that controls how many hits of the breakpoint are ignored.
    /// The debug adapter is expected to interpret the expression as needed.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsHitConditionalBreakpoints` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hit_condition: Option<String>,
    /// The instruction reference of the breakpoint.
    /// This should be a memory or instruction pointer reference from an `EvaluateResponse`, `Variable`, `StackFrame`, `GotoTarget`, or `Breakpoint`.
    pub instruction_reference: String,
    /// The mode of this breakpoint. If defined, this must be one of the `breakpointModes` the debug adapter advertised in its `Capabilities`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mode: Option<String>,
    /// The offset from the instruction reference in bytes.
    /// This can be negative.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub offset: Option<u32>,
}

/// Logical areas that can be invalidated by the `invalidated` event.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum InvalidatedAreas {
    /// All previously fetched data has become invalid and needs to be refetched.
    All,
    /// Previously fetched stack related data has become invalid and needs to be refetched.
    Stacks,
    /// Previously fetched thread related data has become invalid and needs to be refetched.
    Threads,
    /// Previously fetched variable data has become invalid and needs to be refetched.
    Variables,
    #[default]
    #[serde(other)]
    Unknown,
}

/// This event signals that some state in the debug adapter has changed and requires that the client needs to re-render the data snapshot previously requested.
/// Debug adapters do not have to emit this event for runtime changes like stopped or thread events because in that case the client refetches the new state anyway. But the event can be used for example to refresh the UI after rendering formatting has changed in the debug adapter.
/// This event should only be sent if the corresponding capability `supportsInvalidatedEvent` is true.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct InvalidatedEvent {
    /// Set of logical areas that got invalidated. This property has a hint characteristic: a client can only be expected to make a 'best effort' in honoring the areas but there are no guarantees. If this property is missing, empty, or if values are not understood, the client should assume a single value `all`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub areas: Option<Vec<InvalidatedAreas>>,
    /// If specified, the client only needs to refetch data related to this stack frame (and the `threadId` is ignored).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub stack_frame_id: Option<u64>,
    /// If specified, the client only needs to refetch data related to this thread.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub thread_id: Option<u64>,
}

/// The event indicates that some source has been added, changed, or removed from the set of all loaded sources.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct LoadedSourceEvent {
    /// The reason for the event.
    pub reason: LoadedSourceEventReason,
    /// The new, changed, or removed source.
    pub source: Source,
}

/// The reason for the event.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum LoadedSourceEventReason {
    New,
    Changed,
    Removed,
}

/// Arguments for `loadedSources` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
pub struct LoadedSourcesArguments;

/// Response to `loadedSources` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct LoadedSourcesResponse {
    /// Set of loaded sources.
    pub sources: Vec<Source>,
}

/// Arguments for `locations` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct LocationsArguments {
    /// Location reference to resolve.
    pub location_reference: u64,
}

/// Response to `locations` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct LocationsResponse {
    /// Position of the location within the `line`. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If no column is given, the first position in the start line is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// End position of the location within `endLine`, present if the location refers to a range. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_column: Option<u32>,
    /// End line of the location, present if the location refers to a range.  The client capability `linesStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_line: Option<u32>,
    /// The line number of the location. The client capability `linesStartAt1` determines whether it is 0- or 1-based.
    pub line: u32,
    /// The source containing the location; either `source.path` or `source.sourceReference` must be specified.
    pub source: Source,
}

/// This event indicates that some memory range has been updated. It should only be sent if the corresponding capability `supportsMemoryEvent` is true.
/// Clients typically react to the event by re-issuing a `readMemory` request if they show the memory identified by the `memoryReference` and if the updated memory range overlaps the displayed range. Clients should not make assumptions how individual memory references relate to each other, so they should not assume that they are part of a single continuous address range and might overlap.
/// Debug adapters can use this event to indicate that the contents of a memory range has changed due to some other request like `setVariable` or `setExpression`. Debug adapters are not expected to emit this event for each and every memory change of a running program, because that information is typically not available from debuggers and it would flood clients with too many events.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MemoryEvent {
    /// Number of bytes updated.
    pub count: u64,
    /// Memory reference of a memory range that has been updated.
    pub memory_reference: String,
    /// Starting offset in bytes where memory has been updated. Can be negative.
    pub offset: u32,
}

/// A structured message object. Used to return errors from requests.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Message {
    /// A format string for the message. Embedded variables have the form `{name}`.
    /// If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes.
    pub format: String,
    /// Unique (within a debug adapter implementation) identifier for the message. The purpose of these error IDs is to help extension authors that have the requirement that every user visible error message needs a corresponding error number, so that users or customer support can find information about the specific error more easily.
    pub id: u64,
    /// If true send to telemetry.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub send_telemetry: Option<bool>,
    /// If true show user.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub show_user: Option<bool>,
    /// A url where additional information about this message can be found.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    /// A label that is presented to the user as the UI for opening the url.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub url_label: Option<String>,
    /// An object used as a dictionary for looking up the variables in the format string.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub variables: Option<serde_json::Value>,
}

/// A Module object represents a row in the modules view.
/// The `id` attribute identifies a module in the modules view and is used in a `module` event for identifying a module for adding, updating or deleting.
/// The `name` attribute is used to minimally render the module in the UI.
///
/// Additional attributes can be added to the module. They show up in the module view if they have a corresponding `ColumnDescriptor`.
///
/// To avoid an unnecessary proliferation of additional attributes with similar semantics but different names, we recommend to re-use attributes from the 'recommended' list below first, and only introduce new attributes if nothing appropriate could be found.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Module {
    /// Address range covered by this module.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub address_range: Option<String>,
    /// Module created or modified, encoded as a RFC 3339 timestamp.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub date_time_stamp: Option<String>,
    /// Unique identifier for the module.
    pub id: ModuleId,
    /// True if the module is optimized.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub is_optimized: Option<bool>,
    /// True if the module is considered 'user code' by a debugger that supports 'Just My Code'.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub is_user_code: Option<bool>,
    /// A name of the module.
    pub name: String,
    /// Logical full path to the module. The exact definition is implementation defined, but usually this would be a full path to the on-disk file for the module.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub path: Option<String>,
    /// Logical full path to the symbol file. The exact definition is implementation defined.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub symbol_file_path: Option<String>,
    /// User-understandable description of if symbols were found for the module (ex: 'Symbols Loaded', 'Symbols not found', etc.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub symbol_status: Option<String>,
    /// Version of Module.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub version: Option<String>,
}

/// The event indicates that some information about a module has changed.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ModuleEvent {
    /// The new, changed, or removed module. In case of `removed` only the module id is used.
    pub module: Module,
    /// The reason for the event.
    pub reason: ModuleEventReason,
}

/// The reason for the event.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum ModuleEventReason {
    New,
    Changed,
    Removed,
}

/// Arguments for `modules` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ModulesArguments {
    /// The number of modules to return. If `moduleCount` is not specified or 0, all modules are returned.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub module_count: Option<u64>,
    /// The index of the first module to return; if omitted modules start at 0.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub start_module: Option<u64>,
}

/// Response to `modules` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ModulesResponse {
    /// All modules or range of modules.
    pub modules: Vec<Module>,
    /// The total number of modules available.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub total_modules: Option<u64>,
}

/// Arguments for `next` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct NextArguments {
    /// Stepping granularity. If no granularity is specified, a granularity of `statement` is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub granularity: Option<SteppingGranularity>,
    /// If this flag is true, all other suspended threads are not resumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub single_thread: Option<bool>,
    /// Specifies the thread for which to resume execution for one step (of the given granularity).
    pub thread_id: u64,
}

/// The event indicates that the target has produced some output.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct OutputEvent {
    /// The output category. If not specified or if the category is not understood by the client, `console` is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub category: Option<OutputEventCategory>,
    /// The position in `line` where the output was produced. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// Additional data to report. For the `telemetry` category the data is sent to telemetry, for the other categories the data is shown in JSON format.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub data: Option<serde_json::Value>,
    /// Support for keeping an output log organized by grouping related messages.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub group: Option<OutputEventGroup>,
    /// The source location's line where the output was produced.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub line: Option<u32>,
    /// A reference that allows the client to request the location where the new value is declared. For example, if the logged value is function pointer, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location.
    ///
    /// This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub location_reference: Option<u64>,
    /// The output to report.
    ///
    /// ANSI escape sequences may be used to influence text color and styling if `supportsANSIStyling` is present in both the adapter's `Capabilities` and the client's `InitializeRequestArguments`. A client may strip any unrecognized ANSI sequences.
    ///
    /// If the `supportsANSIStyling` capabilities are not both true, then the client should display the output literally.
    pub output: String,
    /// The source location where the output was produced.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source: Option<Source>,
    /// If an attribute `variablesReference` exists and its value is > 0, the output contains objects which can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub variables_reference: Option<u32>,
}

/// The output category. If not specified or if the category is not understood by the client, `console` is assumed.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum OutputEventCategory {
    /// Show the output in the client's default message UI, e.g. a 'debug console'. This category should only be used for informational output from the debugger (as opposed to the debuggee).
    Console,
    /// A hint for the client to show the output in the client's UI for important and highly visible information, e.g. as a popup notification. This category should only be used for important messages from the debugger (as opposed to the debuggee). Since this category value is a hint, clients might ignore the hint and assume the `console` category.
    Important,
    /// Show the output as normal program output from the debuggee.
    Stdout,
    /// Show the output as error program output from the debuggee.
    Stderr,
    /// Send the output to telemetry instead of showing it to the user.
    Telemetry,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Support for keeping an output log organized by grouping related messages.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum OutputEventGroup {
    /// Start a new group in expanded mode. Subsequent output events are members of the group and should be shown indented.
    /// The `output` attribute becomes the name of the group and is not indented.
    Start,
    /// Start a new group in collapsed mode. Subsequent output events are members of the group and should be shown indented (as soon as the group is expanded).
    /// The `output` attribute becomes the name of the group and is not indented.
    StartCollapsed,
    /// End the current group and decrease the indentation of subsequent output events.
    /// A non-empty `output` attribute is shown as the unindented end of the group.
    End,
}

/// Arguments for `pause` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PauseArguments {
    /// Pause execution for this thread.
    pub thread_id: u64,
}

/// The event indicates that the debugger has begun debugging a new process. Either one that it has launched, or one that it has attached to.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ProcessEvent {
    /// If true, the process is running on the same computer as the debug adapter.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub is_local_process: Option<bool>,
    /// The logical name of the process. This is usually the full path to process's executable file. Example: /home/example/myproj/program.js.
    pub name: String,
    /// The size of a pointer or address for this process, in bits. This value may be used by clients when formatting addresses for display.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub pointer_size: Option<u64>,
    /// Describes how the debug engine started debugging this process.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub start_method: Option<ProcessEventStartMethod>,
    /// The process ID of the debugged process, as assigned by the operating system. This property should be omitted for logical processes that do not map to operating system processes on the machine.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub system_process_id: Option<u64>,
}

/// Describes how the debug engine started debugging this process.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcessEventStartMethod {
    /// Process was launched under the debugger.
    Launch,
    /// Debugger attached to an existing process.
    Attach,
    /// A project launcher component has launched a new process in a suspended state and then asked the debugger to attach.
    AttachForSuspendedLaunch,
}

/// The event signals the end of the progress reporting with a final message.
/// This event should only be sent if the corresponding capability `supportsProgressReporting` is true.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ProgressEndEvent {
    /// More detailed progress message. If omitted, the previous message (if any) is used.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// The ID that was introduced in the initial `ProgressStartEvent`.
    pub progress_id: String,
}

/// The event signals that a long running operation is about to start and provides additional information for the client to set up a corresponding progress and cancellation UI.
/// The client is free to delay the showing of the UI in order to reduce flicker.
/// This event should only be sent if the corresponding capability `supportsProgressReporting` is true.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ProgressStartEvent {
    /// If true, the request that reports progress may be cancelled with a `cancel` request.
    /// So this property basically controls whether the client should use UX that supports cancellation.
    /// Clients that don't support cancellation are allowed to ignore the setting.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub cancellable: Option<bool>,
    /// More detailed progress message.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// Progress percentage to display (value range: 0 to 100). If omitted no percentage is shown.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub percentage: Option<u64>,
    /// An ID that can be used in subsequent `progressUpdate` and `progressEnd` events to make them refer to the same progress reporting.
    /// IDs must be unique within a debug session.
    pub progress_id: String,
    /// The request ID that this progress report is related to. If specified a debug adapter is expected to emit progress events for the long running request until the request has been either completed or cancelled.
    /// If the request ID is omitted, the progress report is assumed to be related to some general activity of the debug adapter.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub request_id: Option<u64>,
    /// Short title of the progress reporting. Shown in the UI to describe the long running operation.
    pub title: String,
}

/// The event signals that the progress reporting needs to be updated with a new message and/or percentage.
/// The client does not have to update the UI immediately, but the clients needs to keep track of the message and/or percentage values.
/// This event should only be sent if the corresponding capability `supportsProgressReporting` is true.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ProgressUpdateEvent {
    /// More detailed progress message. If omitted, the previous message (if any) is used.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    /// Progress percentage to display (value range: 0 to 100). If omitted no percentage is shown.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub percentage: Option<u64>,
    /// The ID that was introduced in the initial `progressStart` event.
    pub progress_id: String,
}

/// Arguments for `readMemory` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ReadMemoryArguments {
    /// Number of bytes to read at the specified location and offset.
    pub count: u64,
    /// Memory reference to the base location from which data should be read.
    pub memory_reference: String,
    /// Offset (in bytes) to be applied to the reference location before reading data. Can be negative.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub offset: Option<u32>,
}

/// Response to `readMemory` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ReadMemoryResponse {
    /// The address of the first byte of data returned.
    /// Treated as a hex value if prefixed with `0x`, or as a decimal value otherwise.
    pub address: String,
    /// The bytes read from memory, encoded using base64. If the decoded length of `data` is less than the requested `count` in the original `readMemory` request, and `unreadableBytes` is zero or omitted, then the client should assume it's reached the end of readable memory.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub data: Option<String>,
    /// The number of unreadable bytes encountered after the last successfully read byte.
    /// This can be used to determine the number of bytes that should be skipped before a subsequent `readMemory` request succeeds.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub unreadable_bytes: Option<u64>,
}

/// Arguments for `restartFrame` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RestartFrameArguments {
    /// Restart the stack frame identified by `frameId`. The `frameId` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details.
    pub frame_id: u64,
}

/// Arguments for `reverseContinue` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ReverseContinueArguments {
    /// If this flag is true, backward execution is resumed only for the thread with given `threadId`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub single_thread: Option<bool>,
    /// Specifies the active thread. If the debug adapter supports single thread execution (see `supportsSingleThreadExecutionRequests`) and the `singleThread` argument is true, only the thread with this ID is resumed.
    pub thread_id: u64,
}

/// Arguments for `runInTerminal` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RunInTerminalRequestArguments {
    /// List of arguments. The first argument is the command to run.
    pub args: Vec<String>,
    /// This property should only be set if the corresponding capability `supportsArgsCanBeInterpretedByShell` is true. If the client uses an intermediary shell to launch the application, then the client must not attempt to escape characters with special meanings for the shell. The user is fully responsible for escaping as needed and that arguments using special characters may not be portable across shells.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub args_can_be_interpreted_by_shell: Option<bool>,
    /// Working directory for the command. For non-empty, valid paths this typically results in execution of a change directory command.
    pub cwd: String,
    /// Environment key-value pairs that are added to or removed from the default environment.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub env: Option<serde_json::Value>,
    /// What kind of terminal to launch. Defaults to `integrated` if not specified.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub kind: Option<RunInTerminalRequestArgumentsKind>,
    /// Title of the terminal.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub title: Option<String>,
}

/// What kind of terminal to launch. Defaults to `integrated` if not specified.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum RunInTerminalRequestArgumentsKind {
    Integrated,
    External,
}

/// Response to `runInTerminal` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RunInTerminalResponse {
    /// The process ID. The value should be less than or equal to 2147483647 (2^31-1).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub process_id: Option<u32>,
    /// The process ID of the terminal shell. The value should be less than or equal to 2147483647 (2^31-1).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub shell_process_id: Option<u32>,
}

/// A `Scope` is a named container for variables. Optionally a scope can map to a source or a range within a source.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Scope {
    /// Start position of the range covered by the scope. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// End position of the range covered by the scope. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_column: Option<u32>,
    /// The end line of the range covered by this scope.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_line: Option<u32>,
    /// If true, the number of variables in this scope is large or expensive to retrieve.
    pub expensive: bool,
    /// The number of indexed variables in this scope.
    /// The client can use this information to present the variables in a paged UI and fetch them in chunks.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub indexed_variables: Option<u32>,
    /// The start line of the range covered by this scope.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub line: Option<u32>,
    /// Name of the scope such as 'Arguments', 'Locals', or 'Registers'. This string is shown in the UI as is and can be translated.
    pub name: String,
    /// The number of named variables in this scope.
    /// The client can use this information to present the variables in a paged UI and fetch them in chunks.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub named_variables: Option<u32>,
    /// A hint for how to present this scope in the UI. If this attribute is missing, the scope is shown with a generic UI.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub presentation_hint: Option<ScopePresentationHint>,
    /// The source for this scope.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source: Option<Source>,
    /// The variables of this scope can be retrieved by passing the value of `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details.
    pub variables_reference: u32,
}

/// A hint for how to present this scope in the UI. If this attribute is missing, the scope is shown with a generic UI.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum ScopePresentationHint {
    /// Scope contains method arguments.
    Arguments,
    /// Scope contains local variables.
    Locals,
    /// Scope contains registers. Only a single `registers` scope should be returned from a `scopes` request.
    Registers,
    /// Scope contains one or more return values.
    ReturnValue,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Arguments for `scopes` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ScopesArguments {
    /// Retrieve the scopes for the stack frame identified by `frameId`. The `frameId` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details.
    pub frame_id: u64,
}

/// Response to `scopes` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ScopesResponse {
    /// The scopes of the stack frame. If the array has length zero, there are no scopes available.
    pub scopes: Vec<Scope>,
}

/// Arguments for `setBreakpoints` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetBreakpointsArguments {
    /// The code locations of the breakpoints.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub breakpoints: Option<Vec<SourceBreakpoint>>,
    /// Deprecated: The code locations of the breakpoints.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub lines: Option<Vec<u64>>,
    /// The source location of the breakpoints; either `source.path` or `source.sourceReference` must be specified.
    pub source: Source,
    /// A value of true indicates that the underlying source has been modified which results in new breakpoint locations.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source_modified: Option<bool>,
}

/// Response to `setBreakpoints` request.
/// Returned is information about each breakpoint created by this request.
/// This includes the actual code location and whether the breakpoint could be verified.
/// The breakpoints returned are in the same order as the elements of the `breakpoints`
/// (or the deprecated `lines`) array in the arguments.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetBreakpointsResponse {
    /// Information about the breakpoints.
    /// The array elements are in the same order as the elements of the `breakpoints` (or the deprecated `lines`) array in the arguments.
    pub breakpoints: Vec<Breakpoint>,
}

/// Arguments for `setDataBreakpoints` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetDataBreakpointsArguments {
    /// The contents of this array replaces all existing data breakpoints. An empty array clears all data breakpoints.
    pub breakpoints: Vec<DataBreakpoint>,
}

/// Response to `setDataBreakpoints` request.
/// Returned is information about each breakpoint created by this request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetDataBreakpointsResponse {
    /// Information about the data breakpoints. The array elements correspond to the elements of the input argument `breakpoints` array.
    pub breakpoints: Vec<Breakpoint>,
}

/// Arguments for `setExceptionBreakpoints` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetExceptionBreakpointsArguments {
    /// Configuration options for selected exceptions.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsExceptionOptions` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exception_options: Option<Vec<ExceptionOptions>>,
    /// Set of exception filters and their options. The set of all possible exception filters is defined by the `exceptionBreakpointFilters` capability. This attribute is only honored by a debug adapter if the corresponding capability `supportsExceptionFilterOptions` is true. The `filter` and `filterOptions` sets are additive.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub filter_options: Option<Vec<ExceptionFilterOptions>>,
    /// Set of exception filters specified by their ID. The set of all possible exception filters is defined by the `exceptionBreakpointFilters` capability. The `filter` and `filterOptions` sets are additive.
    pub filters: Vec<String>,
}

/// Response to `setExceptionBreakpoints` request.
/// The response contains an array of `Breakpoint` objects with information about each exception breakpoint or filter. The `Breakpoint` objects are in the same order as the elements of the `filters`, `filterOptions`, `exceptionOptions` arrays given as arguments. If both `filters` and `filterOptions` are given, the returned array must start with `filters` information first, followed by `filterOptions` information.
/// The `verified` property of a `Breakpoint` object signals whether the exception breakpoint or filter could be successfully created and whether the condition is valid. In case of an error the `message` property explains the problem. The `id` property can be used to introduce a unique ID for the exception breakpoint or filter so that it can be updated subsequently by sending breakpoint events.
/// For backward compatibility both the `breakpoints` array and the enclosing `body` are optional. If these elements are missing a client is not able to show problems for individual exception breakpoints or filters.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetExceptionBreakpointsResponse {
    /// Information about the exception breakpoints or filters.
    /// The breakpoints returned are in the same order as the elements of the `filters`, `filterOptions`, `exceptionOptions` arrays in the arguments. If both `filters` and `filterOptions` are given, the returned array must start with `filters` information first, followed by `filterOptions` information.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub breakpoints: Option<Vec<Breakpoint>>,
}

/// Arguments for `setExpression` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetExpressionArguments {
    /// The l-value expression to assign to.
    pub expression: String,
    /// Specifies how the resulting value should be formatted.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub format: Option<ValueFormat>,
    /// Evaluate the expressions in the scope of this stack frame. If not specified, the expressions are evaluated in the global scope.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub frame_id: Option<u64>,
    /// The value expression to assign to the l-value expression.
    pub value: String,
}

/// Response to `setExpression` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetExpressionResponse {
    /// The number of indexed child variables.
    /// The client can use this information to present the variables in a paged UI and fetch them in chunks.
    /// The value should be less than or equal to 2147483647 (2^31-1).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub indexed_variables: Option<u32>,
    /// A memory reference to a location appropriate for this result.
    /// For pointer type eval results, this is generally a reference to the memory address contained in the pointer.
    /// This attribute may be returned by a debug adapter if corresponding capability `supportsMemoryReferences` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub memory_reference: Option<String>,
    /// The number of named child variables.
    /// The client can use this information to present the variables in a paged UI and fetch them in chunks.
    /// The value should be less than or equal to 2147483647 (2^31-1).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub named_variables: Option<u32>,
    /// Properties of a value that can be used to determine how to render the result in the UI.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub presentation_hint: Option<VariablePresentationHint>,
    /// The type of the value.
    /// This attribute should only be returned by a debug adapter if the corresponding capability `supportsVariableType` is true.
    #[serde(rename = "type")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ty: Option<String>,
    /// The new value of the expression.
    pub value: String,
    /// A reference that allows the client to request the location where the new value is declared. For example, if the new value is function pointer, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location.
    ///
    /// This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub value_location_reference: Option<u64>,
    /// If `variablesReference` is > 0, the evaluate result is structured and its children can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub variables_reference: Option<u32>,
}

/// Arguments for `setFunctionBreakpoints` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetFunctionBreakpointsArguments {
    /// The function names of the breakpoints.
    pub breakpoints: Vec<FunctionBreakpoint>,
}

/// Response to `setFunctionBreakpoints` request.
/// Returned is information about each breakpoint created by this request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetFunctionBreakpointsResponse {
    /// Information about the breakpoints. The array elements correspond to the elements of the `breakpoints` array.
    pub breakpoints: Vec<Breakpoint>,
}

/// Arguments for `setInstructionBreakpoints` request
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetInstructionBreakpointsArguments {
    /// The instruction references of the breakpoints
    pub breakpoints: Vec<InstructionBreakpoint>,
}

/// Response to `setInstructionBreakpoints` request
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetInstructionBreakpointsResponse {
    /// Information about the breakpoints. The array elements correspond to the elements of the `breakpoints` array.
    pub breakpoints: Vec<Breakpoint>,
}

/// Arguments for `setVariable` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetVariableArguments {
    /// Specifies details on how to format the response value.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub format: Option<ValueFormat>,
    /// The name of the variable in the container.
    pub name: String,
    /// The value of the variable.
    pub value: String,
    /// The reference of the variable container. The `variablesReference` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details.
    pub variables_reference: u32,
}

/// Response to `setVariable` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetVariableResponse {
    /// The number of indexed child variables.
    /// The client can use this information to present the variables in a paged UI and fetch them in chunks.
    /// The value should be less than or equal to 2147483647 (2^31-1).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub indexed_variables: Option<u32>,
    /// A memory reference to a location appropriate for this result.
    /// For pointer type eval results, this is generally a reference to the memory address contained in the pointer.
    /// This attribute may be returned by a debug adapter if corresponding capability `supportsMemoryReferences` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub memory_reference: Option<String>,
    /// The number of named child variables.
    /// The client can use this information to present the variables in a paged UI and fetch them in chunks.
    /// The value should be less than or equal to 2147483647 (2^31-1).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub named_variables: Option<u32>,
    /// The type of the new value. Typically shown in the UI when hovering over the value.
    #[serde(rename = "type")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ty: Option<String>,
    /// The new value of the variable.
    pub value: String,
    /// A reference that allows the client to request the location where the new value is declared. For example, if the new value is function pointer, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location.
    ///
    /// This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub value_location_reference: Option<u64>,
    /// If `variablesReference` is > 0, the new value is structured and its children can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details.
    ///
    /// If this property is included in the response, any `variablesReference` previously associated with the updated variable, and those of its children, are no longer valid.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub variables_reference: Option<u32>,
}

/// A `Source` is a descriptor for source code.
/// It is returned from the debug adapter as part of a `StackFrame` and it is used by clients when specifying breakpoints.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Source {
    /// Additional data that a debug adapter might want to loop through the client.
    /// The client should leave the data intact and persist it across sessions. The client should not interpret the data.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub adapter_data: Option<serde_json::Value>,
    /// The checksums associated with this file.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub checksums: Option<Vec<Checksum>>,
    /// The short name of the source. Every source returned from the debug adapter has a name.
    /// When sending a source to the debug adapter this name is optional.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// The origin of this source. For example, 'internal module', 'inlined content from source map', etc.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub origin: Option<String>,
    /// The path of the source to be shown in the UI.
    /// It is only used to locate and load the content of the source if no `sourceReference` is specified (or its value is 0).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub path: Option<String>,
    /// A hint for how to present the source in the UI.
    /// A value of `deemphasize` can be used to indicate that the source is not available or that it is skipped on stepping.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub presentation_hint: Option<SourcePresentationHint>,
    /// If the value > 0 the contents of the source must be retrieved through the `source` request (even if a path is specified).
    /// Since a `sourceReference` is only valid for a session, it can not be used to persist a source.
    /// The value should be less than or equal to 2147483647 (2^31-1).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source_reference: Option<u32>,
    /// A list of sources that are related to this source. These may be the source that generated this source.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub sources: Option<Vec<Source>>,
}

/// A hint for how to present the source in the UI.
/// A value of `deemphasize` can be used to indicate that the source is not available or that it is skipped on stepping.
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum SourcePresentationHint {
    Normal,
    Emphasize,
    Deemphasize,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Arguments for `source` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceArguments {
    /// Specifies the source content to load. Either `source.path` or `source.sourceReference` must be specified.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source: Option<Source>,
    /// The reference to the source. This is the same as `source.sourceReference`.
    /// This is provided for backward compatibility since old clients do not understand the `source` attribute.
    pub source_reference: u32,
}

/// Properties of a breakpoint or logpoint passed to the `setBreakpoints` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceBreakpoint {
    /// Start position within source line of the breakpoint or logpoint. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// The expression for conditional breakpoints.
    /// It is only honored by a debug adapter if the corresponding capability `supportsConditionalBreakpoints` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub condition: Option<String>,
    /// The expression that controls how many hits of the breakpoint are ignored.
    /// The debug adapter is expected to interpret the expression as needed.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsHitConditionalBreakpoints` is true.
    /// If both this property and `condition` are specified, `hitCondition` should be evaluated only if the `condition` is met, and the debug adapter should stop only if both conditions are met.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hit_condition: Option<String>,
    /// The source line of the breakpoint or logpoint.
    pub line: u32,
    /// If this attribute exists and is non-empty, the debug adapter must not 'break' (stop)
    /// but log the message instead. Expressions within `{}` are interpolated.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsLogPoints` is true.
    /// If either `hitCondition` or `condition` is specified, then the message should only be logged if those conditions are met.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub log_message: Option<String>,
    /// The mode of this breakpoint. If defined, this must be one of the `breakpointModes` the debug adapter advertised in its `Capabilities`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mode: Option<String>,
}

/// Response to `source` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceResponse {
    /// Content of the source reference.
    pub content: String,
    /// Content type (MIME type) of the source.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mime_type: Option<String>,
}

/// A Stackframe contains the source location.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StackFrame {
    /// Indicates whether this frame can be restarted with the `restartFrame` request. Clients should only use this if the debug adapter supports the `restart` request and the corresponding capability `supportsRestartFrame` is true. If a debug adapter has this capability, then `canRestart` defaults to `true` if the property is absent.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub can_restart: Option<bool>,
    /// Start position of the range covered by the stack frame. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. If attribute `source` is missing or doesn't exist, `column` is 0 and should be ignored by the client.
    pub column: u32,
    /// End position of the range covered by the stack frame. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_column: Option<u32>,
    /// The end line of the range covered by the stack frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_line: Option<u32>,
    /// An identifier for the stack frame. It must be unique across all threads.
    /// This id can be used to retrieve the scopes of the frame with the `scopes` request or to restart the execution of a stack frame.
    pub id: u64,
    /// A memory reference for the current instruction pointer in this frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub instruction_pointer_reference: Option<String>,
    /// The line within the source of the frame. If the source attribute is missing or doesn't exist, `line` is 0 and should be ignored by the client.
    pub line: u32,
    /// The module associated with this frame, if any.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub module_id: Option<ModuleId>,
    /// The name of the stack frame, typically a method name.
    pub name: String,
    /// A hint for how to present this frame in the UI.
    /// A value of `label` can be used to indicate that the frame is an artificial frame that is used as a visual label or separator. A value of `subtle` can be used to change the appearance of a frame in a 'subtle' way.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub presentation_hint: Option<StackFramePresentationHint>,
    /// The source of the frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub source: Option<Source>,
}

/// A hint for how to present this frame in the UI.
/// A value of `label` can be used to indicate that the frame is an artificial frame that is used as a visual label or separator. A value of `subtle` can be used to change the appearance of a frame in a 'subtle' way.
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum StackFramePresentationHint {
    Normal,
    Label,
    Subtle,
    #[serde(rename = "deemphasize")]
    Deemphasize,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Provides formatting information for a stack frame.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StackFrameFormat {
    /// Display the value in hex.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hex: Option<bool>,
    /// Includes all stack frames, including those the debug adapter might otherwise hide.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub include_all: Option<bool>,
    /// Displays the line number of the stack frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub line: Option<bool>,
    /// Displays the module of the stack frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub module: Option<bool>,
    /// Displays the names of parameters for the stack frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub parameter_names: Option<bool>,
    /// Displays the types of parameters for the stack frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub parameter_types: Option<bool>,
    /// Displays the values of parameters for the stack frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub parameter_values: Option<bool>,
    /// Displays parameters for the stack frame.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub parameters: Option<bool>,
}

/// Arguments for `stackTrace` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StackTraceArguments {
    /// Specifies details on how to format the returned `StackFrame.name`. The debug adapter may format requested details in any way that would make sense to a developer.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsValueFormattingOptions` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub format: Option<StackFrameFormat>,
    /// The maximum number of frames to return. If levels is not specified or 0, all frames are returned.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub levels: Option<u64>,
    /// The index of the first frame to return; if omitted frames start at 0.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub start_frame: Option<u64>,
    /// Retrieve the stacktrace for this thread.
    pub thread_id: u64,
}

/// Response to `stackTrace` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StackTraceResponse {
    /// The frames of the stack frame. If the array has length zero, there are no stack frames available.
    /// This means that there is no location information available.
    pub stack_frames: Vec<StackFrame>,
    /// The total number of frames available in the stack. If omitted or if `totalFrames` is larger than the available frames, a client is expected to request frames until a request returns less frames than requested (which indicates the end of the stack). Returning monotonically increasing `totalFrames` values for subsequent requests can be used to enforce paging in the client.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub total_frames: Option<u64>,
}

/// Arguments for `startDebugging` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StartDebuggingRequestArguments {
    /// Arguments passed to the new debug session. The arguments must only contain properties understood by the `launch` or `attach` requests of the debug adapter and they must not contain any client-specific properties (e.g. `type`) or client-specific features (e.g. substitutable 'variables').
    pub configuration: serde_json::Value,
    /// Indicates whether the new debug session should be started with a `launch` or `attach` request.
    pub request: StartDebuggingRequestArgumentsRequest,
}

/// Indicates whether the new debug session should be started with a `launch` or `attach` request.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum StartDebuggingRequestArgumentsRequest {
    Launch,
    Attach,
}

/// Arguments for `stepBack` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StepBackArguments {
    /// Stepping granularity to step. If no granularity is specified, a granularity of `statement` is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub granularity: Option<SteppingGranularity>,
    /// If this flag is true, all other suspended threads are not resumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub single_thread: Option<bool>,
    /// Specifies the thread for which to resume execution for one step backwards (of the given granularity).
    pub thread_id: u64,
}

/// Arguments for `stepIn` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StepInArguments {
    /// Stepping granularity. If no granularity is specified, a granularity of `statement` is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub granularity: Option<SteppingGranularity>,
    /// If this flag is true, all other suspended threads are not resumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub single_thread: Option<bool>,
    /// Id of the target to step into.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub target_id: Option<u64>,
    /// Specifies the thread for which to resume execution for one step-into (of the given granularity).
    pub thread_id: u64,
}

/// A `StepInTarget` can be used in the `stepIn` request and determines into which single target the `stepIn` request should step.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StepInTarget {
    /// Start position of the range covered by the step in target. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub column: Option<u32>,
    /// End position of the range covered by the step in target. It is measured in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_column: Option<u32>,
    /// The end line of the range covered by the step-in target.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub end_line: Option<u32>,
    /// Unique identifier for a step-in target.
    pub id: u64,
    /// The name of the step-in target (shown in the UI).
    pub label: String,
    /// The line of the step-in target.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub line: Option<u32>,
}

/// Arguments for `stepInTargets` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StepInTargetsArguments {
    /// The stack frame for which to retrieve the possible step-in targets.
    pub frame_id: u64,
}

/// Response to `stepInTargets` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StepInTargetsResponse {
    /// The possible step-in targets of the specified source location.
    pub targets: Vec<StepInTarget>,
}

/// Arguments for `stepOut` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StepOutArguments {
    /// Stepping granularity. If no granularity is specified, a granularity of `statement` is assumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub granularity: Option<SteppingGranularity>,
    /// If this flag is true, all other suspended threads are not resumed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub single_thread: Option<bool>,
    /// Specifies the thread for which to resume execution for one step-out (of the given granularity).
    pub thread_id: u64,
}

/// The granularity of one 'step' in the stepping requests `next`, `stepIn`, `stepOut`, and `stepBack`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum SteppingGranularity {
    /// The step should allow the program to run until the current statement has finished executing.
    /// The meaning of a statement is determined by the adapter and it may be considered equivalent to a line.
    /// For example 'for(int i = 0; i < 10; i++)' could be considered to have 3 statements 'int i = 0', 'i < 10', and 'i++'.
    Statement,
    /// The step should allow the program to run until the current source line has executed.
    Line,
    /// The step should allow one instruction to execute (e.g. one x86 instruction).
    Instruction,
}

/// The event indicates that the execution of the debuggee has stopped due to some condition.
/// This can be caused by a breakpoint previously set, a stepping request has completed, by executing a debugger statement etc.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StoppedEvent {
    /// If `allThreadsStopped` is true, a debug adapter can announce that all threads have stopped.
    /// - The client should use this information to enable that all threads can be expanded to access their stacktraces.
    /// - If the attribute is missing or false, only the thread with the given `threadId` can be expanded.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub all_threads_stopped: Option<bool>,
    /// The full reason for the event, e.g. 'Paused on exception'. This string is shown in the UI as is and can be translated.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Ids of the breakpoints that triggered the event. In most cases there is only a single breakpoint but here are some examples for multiple breakpoints:
    /// - Different types of breakpoints map to the same location.
    /// - Multiple source breakpoints get collapsed to the same instruction by the compiler/runtime.
    /// - Multiple function breakpoints with different function names map to the same location.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hit_breakpoint_ids: Option<Vec<u64>>,
    /// A value of true hints to the client that this event should not change the focus.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub preserve_focus_hint: Option<bool>,
    /// The reason for the event.
    /// For backward compatibility this string is shown in the UI if the `description` attribute is missing (but it must not be translated).
    pub reason: StoppedEventReason,
    /// Additional information. E.g. if reason is `exception`, text contains the exception name. This string is shown in the UI.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub text: Option<String>,
    /// The thread which was stopped.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub thread_id: Option<u64>,
}

/// The reason for the event.
/// For backward compatibility this string is shown in the UI if the `description` attribute is missing (but it must not be translated).
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum StoppedEventReason {
    Step,
    Breakpoint,
    Exception,
    Pause,
    Entry,
    Goto,
    #[serde(rename = "function breakpoint")]
    FunctionBreakpoint,
    #[serde(rename = "data breakpoint")]
    DataBreakpoint,
    #[serde(rename = "instruction breakpoint")]
    InstructionBreakpoint,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Arguments for `terminate` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TerminateArguments {
    /// A value of true indicates that this `terminate` request is part of a restart sequence.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub restart: Option<bool>,
}

/// Arguments for `terminateThreads` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TerminateThreadsArguments {
    /// Ids of threads to be terminated.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub thread_ids: Option<Vec<u64>>,
}

/// The event indicates that debugging of the debuggee has terminated. This does **not** mean that the debuggee itself has exited.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TerminatedEvent {
    /// A debug adapter may set `restart` to true (or to an arbitrary object) to request that the client restarts the session.
    /// The value is not interpreted by the client and passed unmodified as an attribute `__restart` to the `launch` and `attach` requests.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub restart: Option<serde_json::Value>,
}

/// A Thread
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Thread {
    /// Unique identifier for the thread.
    pub id: u64,
    /// The name of the thread.
    pub name: String,
}

/// The event indicates that a thread has started or exited.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ThreadEvent {
    /// The reason for the event.
    pub reason: ThreadEventReason,
    /// The identifier of the thread.
    pub thread_id: u64,
}

/// The reason for the event.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum ThreadEventReason {
    Started,
    Exited,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Response to `threads` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ThreadsResponse {
    /// All threads.
    pub threads: Vec<Thread>,
}

/// Provides formatting information for a value.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ValueFormat {
    /// Display the value in hex.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hex: Option<bool>,
}

/// A Variable is a name/value pair.
/// The `type` attribute is shown if space permits or when hovering over the variable's name.
/// The `kind` attribute is used to render additional properties of the variable, e.g. different icons can be used to indicate that a variable is public or private.
/// If the value is structured (has children), a handle is provided to retrieve the children with the `variables` request.
/// If the number of named or indexed children is large, the numbers should be returned via the `namedVariables` and `indexedVariables` attributes.
/// The client can use this information to present the children in a paged UI and fetch them in chunks.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Variable {
    /// A reference that allows the client to request the location where the variable is declared. This should be present only if the adapter is likely to be able to resolve the location.
    ///
    /// This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub declaration_location_reference: Option<u64>,
    /// The evaluatable name of this variable which can be passed to the `evaluate` request to fetch the variable's value.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub evaluate_name: Option<String>,
    /// The number of indexed child variables.
    /// The client can use this information to present the children in a paged UI and fetch them in chunks.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub indexed_variables: Option<u32>,
    /// A memory reference associated with this variable.
    /// For pointer type variables, this is generally a reference to the memory address contained in the pointer.
    /// For executable data, this reference may later be used in a `disassemble` request.
    /// This attribute may be returned by a debug adapter if corresponding capability `supportsMemoryReferences` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub memory_reference: Option<String>,
    /// The variable's name.
    pub name: String,
    /// The number of named child variables.
    /// The client can use this information to present the children in a paged UI and fetch them in chunks.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub named_variables: Option<u32>,
    /// Properties of a variable that can be used to determine how to render the variable in the UI.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub presentation_hint: Option<VariablePresentationHint>,
    /// The type of the variable's value. Typically shown in the UI when hovering over the value.
    /// This attribute should only be returned by a debug adapter if the corresponding capability `supportsVariableType` is true.
    #[serde(rename = "type")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ty: Option<String>,
    /// The variable's value.
    /// This can be a multi-line text, e.g. for a function the body of a function.
    /// For structured variables (which do not have a simple value), it is recommended to provide a one-line representation of the structured object. This helps to identify the structured object in the collapsed state when its children are not yet visible.
    /// An empty string can be used if no value should be shown in the UI.
    pub value: String,
    /// A reference that allows the client to request the location where the variable's value is declared. For example, if the variable contains a function pointer, the adapter may be able to look up the function's location. This should be present only if the adapter is likely to be able to resolve the location.
    ///
    /// This reference shares the same lifetime as the `variablesReference`. See 'Lifetime of Object References' in the Overview section for details.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub value_location_reference: Option<u64>,
    /// If `variablesReference` is > 0, the variable is structured and its children can be retrieved by passing `variablesReference` to the `variables` request as long as execution remains suspended. See 'Lifetime of Object References' in the Overview section for details.
    pub variables_reference: u32,
}

/// Properties of a variable that can be used to determine how to render the variable in the UI.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct VariablePresentationHint {
    /// Set of attributes represented as an array of strings. Before introducing additional values, try to use the listed values.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub attributes: Option<Vec<VariablePresentationHintAttributes>>,
    /// The kind of variable. Before introducing additional values, try to use the listed values.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub kind: Option<VariablePresentationHintKind>,
    /// If true, clients can present the variable with a UI that supports a specific gesture to trigger its evaluation.
    /// This mechanism can be used for properties that require executing code when retrieving their value and where the code execution can be expensive and/or produce side-effects. A typical example are properties based on a getter function.
    /// Please note that in addition to the `lazy` flag, the variable's `variablesReference` is expected to refer to a variable that will provide the value through another `variable` request.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub lazy: Option<bool>,
    /// Visibility of variable. Before introducing additional values, try to use the listed values.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub visibility: Option<VariablePresentationHintVisibility>,
}

#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum VariablePresentationHintAttributes {
    /// Indicates that the object is static.
    Static,
    /// Indicates that the object is a constant.
    Constant,
    /// Indicates that the object is read only.
    ReadOnly,
    /// Indicates that the object is a raw string.
    RawString,
    /// Indicates that the object can have an Object ID created for it. This is a vestigial attribute that is used by some clients; 'Object ID's are not specified in the protocol.
    HasObjectId,
    /// Indicates that the object has an Object ID associated with it. This is a vestigial attribute that is used by some clients; 'Object ID's are not specified in the protocol.
    CanHaveObjectId,
    /// Indicates that the evaluation had side effects.
    HasSideEffects,
    /// Indicates that the object has its value tracked by a data breakpoint.
    HasDataBreakpoint,
    #[default]
    #[serde(other)]
    Unknown,
}

/// The kind of variable. Before introducing additional values, try to use the listed values.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum VariablePresentationHintKind {
    /// Indicates that the object is a property.
    Property,
    /// Indicates that the object is a method.
    Method,
    /// Indicates that the object is a class.
    Class,
    /// Indicates that the object is data.
    Data,
    /// Indicates that the object is an event.
    Event,
    /// Indicates that the object is a base class.
    BaseClass,
    /// Indicates that the object is an inner class.
    InnerClass,
    /// Indicates that the object is an interface.
    Interface,
    /// Indicates that the object is the most derived class.
    MostDerivedClass,
    /// Indicates that the object is virtual, that means it is a synthetic object introduced by the adapter for rendering purposes, e.g. an index range for large arrays.
    Virtual,
    /// Deprecated: Indicates that a data breakpoint is registered for the object. The `hasDataBreakpoint` attribute should generally be used instead.
    DataBreakpoint,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Visibility of variable. Before introducing additional values, try to use the listed values.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub enum VariablePresentationHintVisibility {
    Public,
    Private,
    Protected,
    Internal,
    Final,
    #[default]
    #[serde(other)]
    Unknown,
}

/// Arguments for `variables` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct VariablesArguments {
    /// The number of variables to return. If count is missing or 0, all variables are returned.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsVariablePaging` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub count: Option<u64>,
    /// Filter to limit the child variables to either named or indexed. If omitted, both types are fetched.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub filter: Option<VariablesArgumentsFilter>,
    /// Specifies details on how to format the Variable values.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsValueFormattingOptions` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub format: Option<ValueFormat>,
    /// The index of the first variable to return; if omitted children start at 0.
    /// The attribute is only honored by a debug adapter if the corresponding capability `supportsVariablePaging` is true.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub start: Option<u64>,
    /// The variable for which to retrieve its children. The `variablesReference` must have been obtained in the current suspended state. See 'Lifetime of Object References' in the Overview section for details.
    pub variables_reference: u32,
}

/// Filter to limit the child variables to either named or indexed. If omitted, both types are fetched.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum VariablesArgumentsFilter {
    Indexed,
    Named,
}

/// Response to `variables` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct VariablesResponse {
    /// All (or a range) of variables for the given variable reference.
    pub variables: Vec<Variable>,
}

/// Arguments for `writeMemory` request.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct WriteMemoryArguments {
    /// Property to control partial writes. If true, the debug adapter should attempt to write memory even if the entire memory region is not writable. In such a case the debug adapter should stop after hitting the first byte of memory that cannot be written and return the number of bytes written in the response via the `offset` and `bytesWritten` properties.
    /// If false or missing, a debug adapter should attempt to verify the region is writable before writing, and fail the response if it is not.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub allow_partial: Option<bool>,
    /// Bytes to write, encoded using base64.
    pub data: String,
    /// Memory reference to the base location to which data should be written.
    pub memory_reference: String,
    /// Offset (in bytes) to be applied to the reference location before writing data. Can be negative.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub offset: Option<u32>,
}

/// Response to `writeMemory` request.
#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct WriteMemoryResponse {
    /// Property that should be returned when `allowPartial` is true to indicate the number of bytes starting from address that were successfully written.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub bytes_written: Option<u64>,
    /// Property that should be returned when `allowPartial` is true to indicate the offset of the first byte of data successfully written. Can be negative.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub offset: Option<u32>,
}