aboutsummaryrefslogtreecommitdiff
path: root/src/generated_api.rs
blob: de01e1b2b01ef47d38d5ba04b03d6324a12b7999 (plain)
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
// This file is generated.
// Any manual edits will be overwritten.

#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]
use crate::json_rpc::{RpcRequest, RpcResponse};
use crate::AnyError;
use chrono::{DateTime, Utc};
use reqwest::RequestBuilder;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Serialize)]
pub struct listEventTypesRequest {
    pub filter: MarketFilter,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
}

pub fn listEventTypes(
    rb: RequestBuilder,
    filter: MarketFilter,
    locale: Option<String>,
) -> Result<Vec<EventTypeResult>, AnyError> {
    let req: listEventTypesRequest = listEventTypesRequest { filter, locale };
    let rpc_request: RpcRequest<listEventTypesRequest> =
        RpcRequest::new("SportsAPING/v1.0/listEventTypes".to_owned(), req);
    let resp: RpcResponse<Vec<EventTypeResult>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listCompetitionsRequest {
    pub filter: MarketFilter,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
}

pub fn listCompetitions(
    rb: RequestBuilder,
    filter: MarketFilter,
    locale: Option<String>,
) -> Result<Vec<CompetitionResult>, AnyError> {
    let req: listCompetitionsRequest =
        listCompetitionsRequest { filter, locale };
    let rpc_request: RpcRequest<listCompetitionsRequest> =
        RpcRequest::new("SportsAPING/v1.0/listCompetitions".to_owned(), req);
    let resp: RpcResponse<Vec<CompetitionResult>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listTimeRangesRequest {
    pub filter: MarketFilter,
    pub granularity: TimeGranularity,
}

pub fn listTimeRanges(
    rb: RequestBuilder,
    filter: MarketFilter,
    granularity: TimeGranularity,
) -> Result<Vec<TimeRangeResult>, AnyError> {
    let req: listTimeRangesRequest = listTimeRangesRequest {
        filter,
        granularity,
    };
    let rpc_request: RpcRequest<listTimeRangesRequest> =
        RpcRequest::new("SportsAPING/v1.0/listTimeRanges".to_owned(), req);
    let resp: RpcResponse<Vec<TimeRangeResult>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listEventsRequest {
    pub filter: MarketFilter,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
}

pub fn listEvents(
    rb: RequestBuilder,
    filter: MarketFilter,
    locale: Option<String>,
) -> Result<Vec<EventResult>, AnyError> {
    let req: listEventsRequest = listEventsRequest { filter, locale };
    let rpc_request: RpcRequest<listEventsRequest> =
        RpcRequest::new("SportsAPING/v1.0/listEvents".to_owned(), req);
    let resp: RpcResponse<Vec<EventResult>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listMarketTypesRequest {
    pub filter: MarketFilter,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
}

pub fn listMarketTypes(
    rb: RequestBuilder,
    filter: MarketFilter,
    locale: Option<String>,
) -> Result<Vec<MarketTypeResult>, AnyError> {
    let req: listMarketTypesRequest = listMarketTypesRequest { filter, locale };
    let rpc_request: RpcRequest<listMarketTypesRequest> =
        RpcRequest::new("SportsAPING/v1.0/listMarketTypes".to_owned(), req);
    let resp: RpcResponse<Vec<MarketTypeResult>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listCountriesRequest {
    pub filter: MarketFilter,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
}

pub fn listCountries(
    rb: RequestBuilder,
    filter: MarketFilter,
    locale: Option<String>,
) -> Result<Vec<CountryCodeResult>, AnyError> {
    let req: listCountriesRequest = listCountriesRequest { filter, locale };
    let rpc_request: RpcRequest<listCountriesRequest> =
        RpcRequest::new("SportsAPING/v1.0/listCountries".to_owned(), req);
    let resp: RpcResponse<Vec<CountryCodeResult>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listVenuesRequest {
    pub filter: MarketFilter,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
}

pub fn listVenues(
    rb: RequestBuilder,
    filter: MarketFilter,
    locale: Option<String>,
) -> Result<Vec<VenueResult>, AnyError> {
    let req: listVenuesRequest = listVenuesRequest { filter, locale };
    let rpc_request: RpcRequest<listVenuesRequest> =
        RpcRequest::new("SportsAPING/v1.0/listVenues".to_owned(), req);
    let resp: RpcResponse<Vec<VenueResult>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listMarketCatalogueRequest {
    pub filter: MarketFilter,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketProjection: Option<Vec<MarketProjection>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sort: Option<MarketSort>,
    pub maxResults: i32,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
}

pub fn listMarketCatalogue(
    rb: RequestBuilder,
    filter: MarketFilter,
    marketProjection: Option<Vec<MarketProjection>>,
    sort: Option<MarketSort>,
    maxResults: i32,
    locale: Option<String>,
) -> Result<Vec<MarketCatalogue>, AnyError> {
    let req: listMarketCatalogueRequest = listMarketCatalogueRequest {
        filter,
        marketProjection,
        sort,
        maxResults,
        locale,
    };
    let rpc_request: RpcRequest<listMarketCatalogueRequest> =
        RpcRequest::new("SportsAPING/v1.0/listMarketCatalogue".to_owned(), req);
    let resp: RpcResponse<Vec<MarketCatalogue>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listMarketBookRequest {
    pub marketIds: Vec<MarketId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priceProjection: Option<PriceProjection>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub orderProjection: Option<OrderProjection>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matchProjection: Option<MatchProjection>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub includeOverallPosition: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub partitionMatchedByStrategyRef: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerStrategyRefs: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub currencyCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matchedSince: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betIds: Option<Vec<BetId>>,
}

pub fn listMarketBook(
    rb: RequestBuilder,
    marketIds: Vec<MarketId>,
    priceProjection: Option<PriceProjection>,
    orderProjection: Option<OrderProjection>,
    matchProjection: Option<MatchProjection>,
    includeOverallPosition: Option<bool>,
    partitionMatchedByStrategyRef: Option<bool>,
    customerStrategyRefs: Option<Vec<String>>,
    currencyCode: Option<String>,
    locale: Option<String>,
    matchedSince: Option<DateTime<Utc>>,
    betIds: Option<Vec<BetId>>,
) -> Result<Vec<MarketBook>, AnyError> {
    let req: listMarketBookRequest = listMarketBookRequest {
        marketIds,
        priceProjection,
        orderProjection,
        matchProjection,
        includeOverallPosition,
        partitionMatchedByStrategyRef,
        customerStrategyRefs,
        currencyCode,
        locale,
        matchedSince,
        betIds,
    };
    let rpc_request: RpcRequest<listMarketBookRequest> =
        RpcRequest::new("SportsAPING/v1.0/listMarketBook".to_owned(), req);
    let resp: RpcResponse<Vec<MarketBook>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listRunnerBookRequest {
    pub marketId: MarketId,
    pub selectionId: SelectionId,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub handicap: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priceProjection: Option<PriceProjection>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub orderProjection: Option<OrderProjection>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matchProjection: Option<MatchProjection>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub includeOverallPosition: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub partitionMatchedByStrategyRef: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerStrategyRefs: Option<Vec<String>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub currencyCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matchedSince: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betIds: Option<Vec<BetId>>,
}

pub fn listRunnerBook(
    rb: RequestBuilder,
    marketId: MarketId,
    selectionId: SelectionId,
    handicap: Option<f64>,
    priceProjection: Option<PriceProjection>,
    orderProjection: Option<OrderProjection>,
    matchProjection: Option<MatchProjection>,
    includeOverallPosition: Option<bool>,
    partitionMatchedByStrategyRef: Option<bool>,
    customerStrategyRefs: Option<Vec<String>>,
    currencyCode: Option<String>,
    locale: Option<String>,
    matchedSince: Option<DateTime<Utc>>,
    betIds: Option<Vec<BetId>>,
) -> Result<Vec<MarketBook>, AnyError> {
    let req: listRunnerBookRequest = listRunnerBookRequest {
        marketId,
        selectionId,
        handicap,
        priceProjection,
        orderProjection,
        matchProjection,
        includeOverallPosition,
        partitionMatchedByStrategyRef,
        customerStrategyRefs,
        currencyCode,
        locale,
        matchedSince,
        betIds,
    };
    let rpc_request: RpcRequest<listRunnerBookRequest> =
        RpcRequest::new("SportsAPING/v1.0/listRunnerBook".to_owned(), req);
    let resp: RpcResponse<Vec<MarketBook>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listCurrentOrdersRequest {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betIds: Option<Vec<BetId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketIds: Option<Vec<MarketId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub orderProjection: Option<OrderProjection>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerOrderRefs: Option<Vec<CustomerOrderRef>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerStrategyRefs: Option<Vec<CustomerStrategyRef>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub placedDateRange: Option<TimeRange>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dateRange: Option<TimeRange>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub orderBy: Option<OrderBy>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sortDir: Option<SortDir>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub fromRecord: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub recordCount: Option<i32>,
}

pub fn listCurrentOrders(
    rb: RequestBuilder,
    betIds: Option<Vec<BetId>>,
    marketIds: Option<Vec<MarketId>>,
    orderProjection: Option<OrderProjection>,
    customerOrderRefs: Option<Vec<CustomerOrderRef>>,
    customerStrategyRefs: Option<Vec<CustomerStrategyRef>>,
    placedDateRange: Option<TimeRange>,
    dateRange: Option<TimeRange>,
    orderBy: Option<OrderBy>,
    sortDir: Option<SortDir>,
    fromRecord: Option<i32>,
    recordCount: Option<i32>,
) -> Result<CurrentOrderSummaryReport, AnyError> {
    let req: listCurrentOrdersRequest = listCurrentOrdersRequest {
        betIds,
        marketIds,
        orderProjection,
        customerOrderRefs,
        customerStrategyRefs,
        placedDateRange,
        dateRange,
        orderBy,
        sortDir,
        fromRecord,
        recordCount,
    };
    let rpc_request: RpcRequest<listCurrentOrdersRequest> =
        RpcRequest::new("SportsAPING/v1.0/listCurrentOrders".to_owned(), req);
    let resp: RpcResponse<CurrentOrderSummaryReport> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listClearedOrdersRequest {
    pub betStatus: BetStatus,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventTypeIds: Option<Vec<EventTypeId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventIds: Option<Vec<EventId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketIds: Option<Vec<MarketId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub runnerIds: Option<Vec<RunnerId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betIds: Option<Vec<BetId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerOrderRefs: Option<Vec<CustomerOrderRef>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerStrategyRefs: Option<Vec<CustomerStrategyRef>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub side: Option<Side>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub settledDateRange: Option<TimeRange>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub groupBy: Option<GroupBy>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub includeItemDescription: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub locale: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub fromRecord: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub recordCount: Option<i32>,
}

pub fn listClearedOrders(
    rb: RequestBuilder,
    betStatus: BetStatus,
    eventTypeIds: Option<Vec<EventTypeId>>,
    eventIds: Option<Vec<EventId>>,
    marketIds: Option<Vec<MarketId>>,
    runnerIds: Option<Vec<RunnerId>>,
    betIds: Option<Vec<BetId>>,
    customerOrderRefs: Option<Vec<CustomerOrderRef>>,
    customerStrategyRefs: Option<Vec<CustomerStrategyRef>>,
    side: Option<Side>,
    settledDateRange: Option<TimeRange>,
    groupBy: Option<GroupBy>,
    includeItemDescription: Option<bool>,
    locale: Option<String>,
    fromRecord: Option<i32>,
    recordCount: Option<i32>,
) -> Result<ClearedOrderSummaryReport, AnyError> {
    let req: listClearedOrdersRequest = listClearedOrdersRequest {
        betStatus,
        eventTypeIds,
        eventIds,
        marketIds,
        runnerIds,
        betIds,
        customerOrderRefs,
        customerStrategyRefs,
        side,
        settledDateRange,
        groupBy,
        includeItemDescription,
        locale,
        fromRecord,
        recordCount,
    };
    let rpc_request: RpcRequest<listClearedOrdersRequest> =
        RpcRequest::new("SportsAPING/v1.0/listClearedOrders".to_owned(), req);
    let resp: RpcResponse<ClearedOrderSummaryReport> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct placeOrdersRequest {
    pub marketId: MarketId,
    pub instructions: Vec<PlaceInstruction>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerRef: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketVersion: Option<MarketVersion>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerStrategyRef: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#async: Option<bool>,
}

pub fn placeOrders(
    rb: RequestBuilder,
    marketId: MarketId,
    instructions: Vec<PlaceInstruction>,
    customerRef: Option<String>,
    marketVersion: Option<MarketVersion>,
    customerStrategyRef: Option<String>,
    r#async: Option<bool>,
) -> Result<PlaceExecutionReport, AnyError> {
    let req: placeOrdersRequest = placeOrdersRequest {
        marketId,
        instructions,
        customerRef,
        marketVersion,
        customerStrategyRef,
        r#async,
    };
    let rpc_request: RpcRequest<placeOrdersRequest> =
        RpcRequest::new("SportsAPING/v1.0/placeOrders".to_owned(), req);
    let resp: RpcResponse<PlaceExecutionReport> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct cancelOrdersRequest {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketId: Option<MarketId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub instructions: Option<Vec<CancelInstruction>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerRef: Option<String>,
}

pub fn cancelOrders(
    rb: RequestBuilder,
    marketId: Option<MarketId>,
    instructions: Option<Vec<CancelInstruction>>,
    customerRef: Option<String>,
) -> Result<CancelExecutionReport, AnyError> {
    let req: cancelOrdersRequest = cancelOrdersRequest {
        marketId,
        instructions,
        customerRef,
    };
    let rpc_request: RpcRequest<cancelOrdersRequest> =
        RpcRequest::new("SportsAPING/v1.0/cancelOrders".to_owned(), req);
    let resp: RpcResponse<CancelExecutionReport> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct replaceOrdersRequest {
    pub marketId: MarketId,
    pub instructions: Vec<ReplaceInstruction>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerRef: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketVersion: Option<MarketVersion>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#async: Option<bool>,
}

pub fn replaceOrders(
    rb: RequestBuilder,
    marketId: MarketId,
    instructions: Vec<ReplaceInstruction>,
    customerRef: Option<String>,
    marketVersion: Option<MarketVersion>,
    r#async: Option<bool>,
) -> Result<ReplaceExecutionReport, AnyError> {
    let req: replaceOrdersRequest = replaceOrdersRequest {
        marketId,
        instructions,
        customerRef,
        marketVersion,
        r#async,
    };
    let rpc_request: RpcRequest<replaceOrdersRequest> =
        RpcRequest::new("SportsAPING/v1.0/replaceOrders".to_owned(), req);
    let resp: RpcResponse<ReplaceExecutionReport> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct updateOrdersRequest {
    pub marketId: MarketId,
    pub instructions: Vec<UpdateInstruction>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerRef: Option<String>,
}

pub fn updateOrders(
    rb: RequestBuilder,
    marketId: MarketId,
    instructions: Vec<UpdateInstruction>,
    customerRef: Option<String>,
) -> Result<UpdateExecutionReport, AnyError> {
    let req: updateOrdersRequest = updateOrdersRequest {
        marketId,
        instructions,
        customerRef,
    };
    let rpc_request: RpcRequest<updateOrdersRequest> =
        RpcRequest::new("SportsAPING/v1.0/updateOrders".to_owned(), req);
    let resp: RpcResponse<UpdateExecutionReport> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listMarketProfitAndLossRequest {
    pub marketIds: Vec<MarketId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub includeSettledBets: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub includeBspBets: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub netOfCommission: Option<bool>,
}

pub fn listMarketProfitAndLoss(
    rb: RequestBuilder,
    marketIds: Vec<MarketId>,
    includeSettledBets: Option<bool>,
    includeBspBets: Option<bool>,
    netOfCommission: Option<bool>,
) -> Result<Vec<MarketProfitAndLoss>, AnyError> {
    let req: listMarketProfitAndLossRequest = listMarketProfitAndLossRequest {
        marketIds,
        includeSettledBets,
        includeBspBets,
        netOfCommission,
    };
    let rpc_request: RpcRequest<listMarketProfitAndLossRequest> =
        RpcRequest::new(
            "SportsAPING/v1.0/listMarketProfitAndLoss".to_owned(),
            req,
        );
    let resp: RpcResponse<Vec<MarketProfitAndLoss>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct setDefaultExposureLimitForMarketGroupsRequest {
    pub marketGroupType: MarketGroupType,
    pub limit: ExposureLimit,
}

pub fn setDefaultExposureLimitForMarketGroups(
    rb: RequestBuilder,
    marketGroupType: MarketGroupType,
    limit: ExposureLimit,
) -> Result<String, AnyError> {
    let req: setDefaultExposureLimitForMarketGroupsRequest =
        setDefaultExposureLimitForMarketGroupsRequest {
            marketGroupType,
            limit,
        };
    let rpc_request: RpcRequest<setDefaultExposureLimitForMarketGroupsRequest> =
        RpcRequest::new(
            "SportsAPING/v1.0/setDefaultExposureLimitForMarketGroups"
                .to_owned(),
            req,
        );
    let resp: RpcResponse<String> = rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct setExposureLimitForMarketGroupRequest {
    pub marketGroup: MarketGroup,
    pub limit: ExposureLimit,
}

pub fn setExposureLimitForMarketGroup(
    rb: RequestBuilder,
    marketGroup: MarketGroup,
    limit: ExposureLimit,
) -> Result<String, AnyError> {
    let req: setExposureLimitForMarketGroupRequest =
        setExposureLimitForMarketGroupRequest { marketGroup, limit };
    let rpc_request: RpcRequest<setExposureLimitForMarketGroupRequest> =
        RpcRequest::new(
            "SportsAPING/v1.0/setExposureLimitForMarketGroup".to_owned(),
            req,
        );
    let resp: RpcResponse<String> = rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct removeDefaultExposureLimitForMarketGroupsRequest {
    pub marketGroupType: MarketGroupType,
}

pub fn removeDefaultExposureLimitForMarketGroups(
    rb: RequestBuilder,
    marketGroupType: MarketGroupType,
) -> Result<String, AnyError> {
    let req: removeDefaultExposureLimitForMarketGroupsRequest =
        removeDefaultExposureLimitForMarketGroupsRequest { marketGroupType };
    let rpc_request: RpcRequest<
        removeDefaultExposureLimitForMarketGroupsRequest,
    > = RpcRequest::new(
        "SportsAPING/v1.0/removeDefaultExposureLimitForMarketGroups".to_owned(),
        req,
    );
    let resp: RpcResponse<String> = rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct removeExposureLimitForMarketGroupRequest {
    pub marketGroup: MarketGroup,
}

pub fn removeExposureLimitForMarketGroup(
    rb: RequestBuilder,
    marketGroup: MarketGroup,
) -> Result<String, AnyError> {
    let req: removeExposureLimitForMarketGroupRequest =
        removeExposureLimitForMarketGroupRequest { marketGroup };
    let rpc_request: RpcRequest<removeExposureLimitForMarketGroupRequest> =
        RpcRequest::new(
            "SportsAPING/v1.0/removeExposureLimitForMarketGroup".to_owned(),
            req,
        );
    let resp: RpcResponse<String> = rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct listExposureLimitsForMarketGroupsRequest {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketGroupTypeFilter: Option<MarketGroupType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketGroupFilter: Option<Vec<MarketGroup>>,
}

pub fn listExposureLimitsForMarketGroups(
    rb: RequestBuilder,
    marketGroupTypeFilter: Option<MarketGroupType>,
    marketGroupFilter: Option<Vec<MarketGroup>>,
) -> Result<Vec<ExposureLimitsForMarketGroups>, AnyError> {
    let req: listExposureLimitsForMarketGroupsRequest =
        listExposureLimitsForMarketGroupsRequest {
            marketGroupTypeFilter,
            marketGroupFilter,
        };
    let rpc_request: RpcRequest<listExposureLimitsForMarketGroupsRequest> =
        RpcRequest::new(
            "SportsAPING/v1.0/listExposureLimitsForMarketGroups".to_owned(),
            req,
        );
    let resp: RpcResponse<Vec<ExposureLimitsForMarketGroups>> =
        rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct unblockMarketGroupRequest {
    pub marketGroup: MarketGroup,
}

pub fn unblockMarketGroup(
    rb: RequestBuilder,
    marketGroup: MarketGroup,
) -> Result<String, AnyError> {
    let req: unblockMarketGroupRequest =
        unblockMarketGroupRequest { marketGroup };
    let rpc_request: RpcRequest<unblockMarketGroupRequest> =
        RpcRequest::new("SportsAPING/v1.0/unblockMarketGroup".to_owned(), req);
    let resp: RpcResponse<String> = rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

pub fn getExposureReuseEnabledEvents(
    rb: RequestBuilder,
) -> Result<Vec<i64>, AnyError> {
    let rpc_request: RpcRequest<()> = RpcRequest::new(
        "SportsAPING/v1.0/getExposureReuseEnabledEvents".to_owned(),
        (),
    );
    let resp: RpcResponse<Vec<i64>> = rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct addExposureReuseEnabledEventsRequest {
    pub eventIds: Vec<i64>,
}

pub fn addExposureReuseEnabledEvents(
    rb: RequestBuilder,
    eventIds: Vec<i64>,
) -> Result<String, AnyError> {
    let req: addExposureReuseEnabledEventsRequest =
        addExposureReuseEnabledEventsRequest { eventIds };
    let rpc_request: RpcRequest<addExposureReuseEnabledEventsRequest> =
        RpcRequest::new(
            "SportsAPING/v1.0/addExposureReuseEnabledEvents".to_owned(),
            req,
        );
    let resp: RpcResponse<String> = rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}

#[derive(Serialize)]
pub struct removeExposureReuseEnabledEventsRequest {
    pub eventIds: Vec<i64>,
}

pub fn removeExposureReuseEnabledEvents(
    rb: RequestBuilder,
    eventIds: Vec<i64>,
) -> Result<String, AnyError> {
    let req: removeExposureReuseEnabledEventsRequest =
        removeExposureReuseEnabledEventsRequest { eventIds };
    let rpc_request: RpcRequest<removeExposureReuseEnabledEventsRequest> =
        RpcRequest::new(
            "SportsAPING/v1.0/removeExposureReuseEnabledEvents".to_owned(),
            req,
        );
    let resp: RpcResponse<String> = rb.json(&rpc_request).send()?.json()?;
    Ok(resp.into_inner())
}
#[derive(Debug, Deserialize, Serialize)]
pub enum MarketProjection {
    COMPETITION,
    EVENT,
    EVENT_TYPE,
    MARKET_START_TIME,
    MARKET_DESCRIPTION,
    RUNNER_DESCRIPTION,
    RUNNER_METADATA,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum PriceData {
    SP_AVAILABLE,
    SP_TRADED,
    EX_BEST_OFFERS,
    EX_ALL_OFFERS,
    EX_TRADED,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum MatchProjection {
    NO_ROLLUP,
    ROLLED_UP_BY_PRICE,
    ROLLED_UP_BY_AVG_PRICE,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum OrderProjection {
    ALL,
    EXECUTABLE,
    EXECUTION_COMPLETE,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum MarketStatus {
    INACTIVE,
    OPEN,
    SUSPENDED,
    CLOSED,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum RunnerStatus {
    ACTIVE,
    WINNER,
    LOSER,
    REMOVED_VACANT,
    REMOVED,
    PLACED,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum TimeGranularity {
    DAYS,
    HOURS,
    MINUTES,
}
pub type MarketType = String;
pub type Venue = String;
pub type MarketId = String;
pub type SelectionId = i64;
pub type Handicap = f64;
pub type EventId = String;
pub type EventTypeId = String;
pub type CountryCode = String;
pub type ExchangeId = String;
pub type CompetitionId = String;
pub type Price = f64;
pub type Size = f64;
pub type BetId = String;
pub type MatchId = String;
pub type CustomerOrderRef = String;
pub type CustomerStrategyRef = String;
#[derive(Debug, Deserialize, Serialize)]
pub enum Side {
    BACK,
    LAY,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum OrderStatus {
    PENDING,
    EXECUTION_COMPLETE,
    EXECUTABLE,
    EXPIRED,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum OrderBy {
    BY_BET,
    BY_MARKET,
    BY_PLACE_TIME,
    BY_MATCH_TIME,
    BY_VOID_TIME,
    BY_SETTLED_TIME,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum SortDir {
    EARLIEST_TO_LATEST,
    LATEST_TO_EARLIEST,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum OrderType {
    LIMIT,
    LIMIT_ON_CLOSE,
    MARKET_ON_CLOSE,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum MarketSort {
    MINIMUM_TRADED,
    MAXIMUM_TRADED,
    MINIMUM_AVAILABLE,
    MAXIMUM_AVAILABLE,
    FIRST_TO_START,
    LAST_TO_START,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum MarketBettingType {
    ODDS,
    LINE,
    RANGE,
    ASIAN_HANDICAP_DOUBLE_LINE,
    ASIAN_HANDICAP_SINGLE_LINE,
    FIXED_ODDS,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum ExecutionReportStatus {
    SUCCESS,
    FAILURE,
    PROCESSED_WITH_ERRORS,
    TIMEOUT,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum ExecutionReportErrorCode {
    ERROR_IN_MATCHER,
    PROCESSED_WITH_ERRORS,
    BET_ACTION_ERROR,
    INVALID_ACCOUNT_STATE,
    INVALID_WALLET_STATUS,
    INSUFFICIENT_FUNDS,
    LOSS_LIMIT_EXCEEDED,
    MARKET_SUSPENDED,
    MARKET_NOT_OPEN_FOR_BETTING,
    DUPLICATE_TRANSACTION,
    INVALID_ORDER,
    INVALID_MARKET_ID,
    PERMISSION_DENIED,
    DUPLICATE_BETIDS,
    NO_ACTION_REQUIRED,
    SERVICE_UNAVAILABLE,
    REJECTED_BY_REGULATOR,
    NO_CHASING,
    REGULATOR_IS_NOT_AVAILABLE,
    TOO_MANY_INSTRUCTIONS,
    INVALID_MARKET_VERSION,
    EVENT_EXPOSURE_LIMIT_EXCEEDED,
    EVENT_MATCHED_EXPOSURE_LIMIT_EXCEEDED,
    EVENT_BLOCKED,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum PersistenceType {
    LAPSE,
    PERSIST,
    MARKET_ON_CLOSE,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum InstructionReportStatus {
    SUCCESS,
    FAILURE,
    TIMEOUT,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum InstructionReportErrorCode {
    INVALID_BET_SIZE,
    INVALID_RUNNER,
    BET_TAKEN_OR_LAPSED,
    BET_IN_PROGRESS,
    RUNNER_REMOVED,
    MARKET_NOT_OPEN_FOR_BETTING,
    LOSS_LIMIT_EXCEEDED,
    MARKET_NOT_OPEN_FOR_BSP_BETTING,
    INVALID_PRICE_EDIT,
    INVALID_ODDS,
    INSUFFICIENT_FUNDS,
    INVALID_PERSISTENCE_TYPE,
    ERROR_IN_MATCHER,
    INVALID_BACK_LAY_COMBINATION,
    ERROR_IN_ORDER,
    INVALID_BID_TYPE,
    INVALID_BET_ID,
    CANCELLED_NOT_PLACED,
    RELATED_ACTION_FAILED,
    NO_ACTION_REQUIRED,
    INVALID_MIN_FILL_SIZE,
    INVALID_CUSTOMER_ORDER_REF,
    TIME_IN_FORCE_CONFLICT,
    UNEXPECTED_PERSISTENCE_TYPE,
    INVALID_ORDER_TYPE,
    UNEXPECTED_MIN_FILL_SIZE,
    INVALID_CUSTOMER_STRATEGY_REF,
    BET_LAPSED_PRICE_IMPROVEMENT_TOO_LARGE,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum RollupModel {
    STAKE,
    PAYOUT,
    MANAGED_LIABILITY,
    NONE,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum GroupBy {
    EVENT_TYPE,
    EVENT,
    MARKET,
    RUNNER,
    SIDE,
    BET,
    STRATEGY,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum BetStatus {
    SETTLED,
    VOIDED,
    LAPSED,
    CANCELLED,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum TimeInForce {
    FILL_OR_KILL,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum BetTargetType {
    PAYOUT,
    BACKERS_PROFIT,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum PriceLadderType {
    CLASSIC,
    FINEST,
    LINE_RANGE,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum MarketGroupType {
    EVENT,
}
#[derive(Debug, Deserialize, Serialize)]
pub enum LimitBreachActionType {
    REJECT_BETS,
    STOP_BETTING,
    TEAR_DOWN_MARKET_GROUP,
}
#[derive(Debug, Default, Deserialize, Serialize)]
pub struct MarketFilter {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub textQuery: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub exchangeIds: Option<Vec<ExchangeId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventTypeIds: Option<Vec<EventTypeId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventIds: Option<Vec<EventId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub competitionIds: Option<Vec<CompetitionId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketIds: Option<Vec<MarketId>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub venues: Option<Vec<Venue>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bspOnly: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub turnInPlayEnabled: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub inPlayOnly: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketBettingTypes: Option<Vec<MarketBettingType>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketCountries: Option<Vec<CountryCode>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketTypeCodes: Option<Vec<MarketType>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketStartTime: Option<TimeRange>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub withOrders: Option<Vec<OrderStatus>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub raceTypes: Option<Vec<String>>,
}
/// Information about a market
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketCatalogue {
    pub marketId: String,
    pub marketName: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketStartTime: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<MarketDescription>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub totalMatched: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub runners: Option<Vec<RunnerCatalog>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventType: Option<EventType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub competition: Option<Competition>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub event: Option<Event>,
}
/// The dynamic data in a market
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketBook {
    pub marketId: String,
    pub isMarketDataDelayed: bool,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betDelay: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bspReconciled: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub complete: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub inplay: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub numberOfWinners: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub numberOfRunners: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub numberOfActiveRunners: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lastMatchTime: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub totalMatched: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub totalAvailable: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub crossMatching: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub runnersVoidable: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub version: Option<i64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub runners: Option<Vec<Runner>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub keyLineDescription: Option<KeyLineDescription>,
}
/// Information about the Runners (selections) in a market
#[derive(Debug, Deserialize, Serialize)]
pub struct RunnerCatalog {
    pub selectionId: SelectionId,
    pub runnerName: String,
    pub handicap: f64,
    pub sortPriority: i32,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub metadata: Option<HashMap<String, String>>,
}
/// The dynamic data about runners in a market
#[derive(Debug, Deserialize, Serialize)]
pub struct Runner {
    pub selectionId: SelectionId,
    pub handicap: f64,
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub adjustmentFactor: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lastPriceTraded: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub totalMatched: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub removalDate: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sp: Option<StartingPrices>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ex: Option<ExchangePrices>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub orders: Option<Vec<Order>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matches: Option<Vec<Match>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matchesByStrategy: Option<HashMap<String, Matches>>,
}
/// Information about the Betfair Starting Price. Only available in BSP markets
#[derive(Debug, Deserialize, Serialize)]
pub struct StartingPrices {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub nearPrice: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub farPrice: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub backStakeTaken: Option<Vec<PriceSize>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub layLiabilityTaken: Option<Vec<PriceSize>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub actualSP: Option<f64>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct ExchangePrices {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub availableToBack: Option<Vec<PriceSize>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub availableToLay: Option<Vec<PriceSize>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tradedVolume: Option<Vec<PriceSize>>,
}
/// Event
#[derive(Debug, Deserialize, Serialize)]
pub struct Event {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#id: Option<EventId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub countryCode: Option<CountryCode>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub timezone: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub venue: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub openDate: Option<DateTime<Utc>>,
}
/// Event Result
#[derive(Debug, Deserialize, Serialize)]
pub struct EventResult {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub event: Option<Event>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketCount: Option<i32>,
}
/// Competition
#[derive(Debug, Deserialize, Serialize)]
pub struct Competition {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#id: Option<CompetitionId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
}
/// Competition Result
#[derive(Debug, Deserialize, Serialize)]
pub struct CompetitionResult {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub competition: Option<Competition>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketCount: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub competitionRegion: Option<String>,
}
/// EventType
#[derive(Debug, Deserialize, Serialize)]
pub struct EventType {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#id: Option<EventTypeId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
}
/// EventType Result
#[derive(Debug, Deserialize, Serialize)]
pub struct EventTypeResult {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventType: Option<EventType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketCount: Option<i32>,
}
/// MarketType Result
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketTypeResult {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketType: Option<MarketType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketCount: Option<i32>,
}
/// CountryCode Result
#[derive(Debug, Deserialize, Serialize)]
pub struct CountryCodeResult {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub countryCode: Option<CountryCode>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketCount: Option<i32>,
}
/// Venue Result
#[derive(Debug, Deserialize, Serialize)]
pub struct VenueResult {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub venue: Option<Venue>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketCount: Option<i32>,
}
/// TimeRange
#[derive(Debug, Deserialize, Serialize)]
pub struct TimeRange {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub from: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub to: Option<DateTime<Utc>>,
}
/// TimeRange Result
#[derive(Debug, Deserialize, Serialize)]
pub struct TimeRangeResult {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub timeRange: Option<TimeRange>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketCount: Option<i32>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct Order {
    pub betId: BetId,
    pub orderType: String,
    pub status: String,
    pub persistenceType: String,
    pub side: String,
    pub price: Price,
    pub size: Size,
    pub bspLiability: Size,
    pub placedDate: DateTime<Utc>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub avgPriceMatched: Option<Price>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeMatched: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeRemaining: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeLapsed: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeCancelled: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeVoided: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerOrderRef: Option<CustomerOrderRef>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerStrategyRef: Option<CustomerStrategyRef>,
}
/// Match list.
#[derive(Debug, Deserialize, Serialize)]
pub struct Matches {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matches: Option<Vec<Match>>,
}
/// An individual bet Match, or rollup by price or avg price. Rollup depends on the requested MatchProjection
#[derive(Debug, Deserialize, Serialize)]
pub struct Match {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betId: Option<BetId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matchId: Option<MatchId>,
    pub side: String,
    pub price: Price,
    pub Size: Size,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matchDate: Option<DateTime<Utc>>,
}
/// Market definition
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketState {
    pub status: String,
    pub betDelay: i32,
    pub bspReconciled: bool,
    pub complete: bool,
    pub inplay: bool,
    pub numberOfActiveRunners: i32,
    pub lastMatchTime: DateTime<Utc>,
    pub totalMatched: Size,
    pub totalAvailable: Size,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub keyLineDescription: Option<KeyLineDescription>,
}
/// Market version
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketVersion {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub version: Option<i64>,
}
/// Market definition
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketDescription {
    pub persistenceEnabled: bool,
    pub bspMarket: bool,
    pub marketTime: DateTime<Utc>,
    pub suspendTime: DateTime<Utc>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub settleTime: Option<DateTime<Utc>>,
    pub bettingType: String,
    pub turnInPlayEnabled: bool,
    pub marketType: String,
    pub regulator: String,
    pub marketBaseRate: f64,
    pub discountAllowed: bool,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub wallet: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rules: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rulesHasDate: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub clarifications: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eachWayDivisor: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lineRangeInfo: Option<MarketLineRangeInfo>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub raceType: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priceLadderDescription: Option<PriceLadderDescription>,
}
/// Market Rates
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketRates {
    pub marketBaseRate: f64,
    pub discountAllowed: bool,
}
/// Market Licence
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketLicence {
    pub wallet: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rules: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rulesHasDate: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub clarifications: Option<String>,
}
/// Market Line and Range Info
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketLineRangeInfo {
    pub maxUnitValue: f64,
    pub minUnitValue: f64,
    pub interval: f64,
    pub marketUnit: String,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PriceSize {
    pub price: Price,
    pub size: Size,
}
/// A container representing search results.
#[derive(Debug, Deserialize, Serialize)]
pub struct CurrentOrderSummaryReport {
    pub currentOrders: Vec<CurrentOrderSummary>,
    pub moreAvailable: bool,
}
/// Summary of a current order.
#[derive(Debug, Deserialize, Serialize)]
pub struct CurrentOrderSummary {
    pub betId: BetId,
    pub marketId: MarketId,
    pub selectionId: SelectionId,
    pub handicap: Handicap,
    pub priceSize: PriceSize,
    pub bspLiability: Size,
    pub side: String,
    pub status: String,
    pub persistenceType: String,
    pub orderType: String,
    pub placedDate: DateTime<Utc>,
    pub matchedDate: DateTime<Utc>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub averagePriceMatched: Option<Price>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeMatched: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeRemaining: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeLapsed: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeCancelled: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeVoided: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub regulatorAuthCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub regulatorCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerOrderRef: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerStrategyRef: Option<String>,
}
/// Summary of a cleared order.
#[derive(Debug, Deserialize, Serialize)]
pub struct ClearedOrderSummary {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventTypeId: Option<EventTypeId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventId: Option<EventId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketId: Option<MarketId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub selectionId: Option<SelectionId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub handicap: Option<Handicap>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betId: Option<BetId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub placedDate: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub persistenceType: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub orderType: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub side: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub itemDescription: Option<ItemDescription>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betOutcome: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priceRequested: Option<Price>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub settledDate: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub lastMatchedDate: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betCount: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub commission: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priceMatched: Option<Price>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priceReduced: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeSettled: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub profit: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeCancelled: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerOrderRef: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerStrategyRef: Option<String>,
}
/// A container representing search results.
#[derive(Debug, Deserialize, Serialize)]
pub struct ClearedOrderSummaryReport {
    pub clearedOrders: Vec<ClearedOrderSummary>,
    pub moreAvailable: bool,
}
/// This object contains some text which may be useful to render a betting history view. It offers no long-term warranty as to the correctness of the text.
#[derive(Debug, Deserialize, Serialize)]
pub struct ItemDescription {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventTypeDesc: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventDesc: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketDesc: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketType: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketStartTime: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub runnerDesc: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub numberOfWinners: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eachWayDivisor: Option<f64>,
}
/// This object contains the unique identifier for a runner
#[derive(Debug, Deserialize, Serialize)]
pub struct RunnerId {
    pub marketId: MarketId,
    pub selectionId: SelectionId,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub handicap: Option<Handicap>,
}
/// Instruction to place a new order
#[derive(Debug, Deserialize, Serialize)]
pub struct PlaceInstruction {
    pub orderType: OrderType,
    pub selectionId: SelectionId,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub handicap: Option<Handicap>,
    pub side: Side,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub limitOrder: Option<LimitOrder>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub limitOnCloseOrder: Option<LimitOnCloseOrder>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketOnCloseOrder: Option<MarketOnCloseOrder>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerOrderRef: Option<String>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct PlaceExecutionReport {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerRef: Option<String>,
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub errorCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketId: Option<MarketId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub instructionReports: Option<Vec<PlaceInstructionReport>>,
}
/// Place a new LIMIT order (simple exchange bet for immediate execution)
#[derive(Debug, Deserialize, Serialize)]
pub struct LimitOrder {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub size: Option<Size>,
    pub price: Price,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub persistenceType: Option<PersistenceType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub timeInForce: Option<TimeInForce>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub minFillSize: Option<Size>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betTargetType: Option<BetTargetType>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betTargetSize: Option<Size>,
}
/// Place a new LIMIT_ON_CLOSE bet
#[derive(Debug, Deserialize, Serialize)]
pub struct LimitOnCloseOrder {
    pub liability: Size,
    pub price: Price,
}
/// Place a new MARKET_ON_CLOSE bet
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketOnCloseOrder {
    pub liability: Size,
}
/// Response to a PlaceInstruction
#[derive(Debug, Deserialize, Serialize)]
pub struct PlaceInstructionReport {
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub errorCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub orderStatus: Option<OrderStatus>,
    pub instruction: PlaceInstruction,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub betId: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub placedDate: Option<DateTime<Utc>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub averagePriceMatched: Option<Price>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeMatched: Option<Size>,
}
/// Instruction to fully or partially cancel an order (only applies to LIMIT orders)
#[derive(Debug, Deserialize, Serialize)]
pub struct CancelInstruction {
    pub betId: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sizeReduction: Option<Size>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct CancelExecutionReport {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerRef: Option<String>,
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub errorCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketId: Option<MarketId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub instructionReports: Option<Vec<CancelInstructionReport>>,
}
/// Instruction to replace a LIMIT or LIMIT_ON_CLOSE order at a new price. Original order will be cancelled and a new order placed at the new price for the remaining stake.
#[derive(Debug, Deserialize, Serialize)]
pub struct ReplaceInstruction {
    pub betId: String,
    pub newPrice: Price,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct ReplaceExecutionReport {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerRef: Option<String>,
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub errorCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketId: Option<MarketId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub instructionReports: Option<Vec<ReplaceInstructionReport>>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct ReplaceInstructionReport {
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub errorCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cancelInstructionReport: Option<CancelInstructionReport>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub placeInstructionReport: Option<PlaceInstructionReport>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct CancelInstructionReport {
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub errorCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub instruction: Option<CancelInstruction>,
    pub sizeCancelled: Size,
    pub cancelledDate: DateTime<Utc>,
}
/// Instruction to update LIMIT bet's persistence of an order that do not affect exposure
#[derive(Debug, Deserialize, Serialize)]
pub struct UpdateInstruction {
    pub betId: String,
    pub newPersistenceType: PersistenceType,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct UpdateExecutionReport {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customerRef: Option<String>,
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub errorCode: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketId: Option<MarketId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub instructionReports: Option<Vec<UpdateInstructionReport>>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct UpdateInstructionReport {
    pub status: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub errorCode: Option<String>,
    pub instruction: UpdateInstruction,
}
/// Selection criteria of the returning price data
#[derive(Debug, Deserialize, Serialize)]
pub struct PriceProjection {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub priceData: Option<Vec<PriceData>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub exBestOffersOverrides: Option<ExBestOffersOverrides>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub virtualise: Option<bool>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rolloverStakes: Option<bool>,
}
/// Options to alter the default representation of best offer prices
#[derive(Debug, Deserialize, Serialize)]
pub struct ExBestOffersOverrides {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub bestPricesDepth: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rollupModel: Option<RollupModel>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rollupLimit: Option<i32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rollupLiabilityThreshold: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub rollupLiabilityFactor: Option<i32>,
}
/// Profit and loss in a market
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketProfitAndLoss {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub marketId: Option<String>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub commissionApplied: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub profitAndLosses: Option<Vec<RunnerProfitAndLoss>>,
}
/// Profit and loss if selection is wins or loses
#[derive(Debug, Deserialize, Serialize)]
pub struct RunnerProfitAndLoss {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub selectionId: Option<SelectionId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ifWin: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ifLose: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub ifPlace: Option<f64>,
}
/// Description of the price ladder type and any related data.
#[derive(Debug, Deserialize, Serialize)]
pub struct PriceLadderDescription {
    pub r#type: PriceLadderType,
}
/// Description of a markets key line selection, comprising the selectionId and handicap of the team it is applied to.
#[derive(Debug, Deserialize, Serialize)]
pub struct KeyLineSelection {
    pub selectionId: SelectionId,
    pub handicap: Handicap,
}
/// A list of KeyLineSelection objects describing the key line for the market
#[derive(Debug, Deserialize, Serialize)]
pub struct KeyLineDescription {
    pub keyLine: Vec<KeyLineSelection>,
}
/// Wrapper type that contains accounts exposure limits for a market group type. If default limit exists for group type, defaultLimit value will be populated. Group limits to return can be controller by marketGroupFilter parameter (see listExposureLimitsForMarketGroups operation).
#[derive(Debug, Deserialize, Serialize)]
pub struct ExposureLimitsForMarketGroups {
    pub marketGroupType: MarketGroupType,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub defaultLimit: Option<ExposureLimit>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub groupLimits: Option<Vec<MarketGroupExposureLimit>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub blockedMarketGroups: Option<Vec<MarketGroupId>>,
}
/// Represents a market group
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketGroup {
    pub r#type: MarketGroupType,
    pub r#id: MarketGroupId,
}
/// Container type for market group ID
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketGroupId {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub eventId: Option<i64>,
}
/// Action that should be execute when limit is breached
#[derive(Debug, Deserialize, Serialize)]
pub struct LimitBreachAction {
    pub actionType: LimitBreachActionType,
}
/// Container type for a group exposure limit
#[derive(Debug, Deserialize, Serialize)]
pub struct MarketGroupExposureLimit {
    pub groupId: MarketGroupId,
    pub limit: ExposureLimit,
}
/// Exposure limit and limit breach action. Not populating one of total or matched parameters indicates that no limit should be set for that exposure value.  A special use of this type is when none of its parameters are populated, this can be used to override default limit to "no limit" for a specific instance of market group (see setExposureLimitForMarketGroup operation)
#[derive(Debug, Deserialize, Serialize)]
pub struct ExposureLimit {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub matched: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub total: Option<f64>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub limitBreachAction: Option<LimitBreachAction>,
}