azure_svc_deviceupdate 0.15.0

generated REST API bindings
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
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::de::{value, Deserializer, IntoDeserializer};
use serde::{Deserialize, Serialize, Serializer};
use std::str::FromStr;
pub type ArrayOfStrings = Vec<String>;
#[doc = "Rollback policy for deployment"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CloudInitiatedRollbackPolicy {
    #[doc = "Update information."]
    pub update: UpdateInfo,
    #[doc = "Failure conditions to initiate rollback policy"]
    pub failure: CloudInitiatedRollbackPolicyFailure,
}
impl CloudInitiatedRollbackPolicy {
    pub fn new(update: UpdateInfo, failure: CloudInitiatedRollbackPolicyFailure) -> Self {
        Self { update, failure }
    }
}
#[doc = "Failure conditions to initiate rollback policy"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct CloudInitiatedRollbackPolicyFailure {
    #[doc = "Percentage of devices that failed."]
    #[serde(rename = "devicesFailedPercentage")]
    pub devices_failed_percentage: i64,
    #[doc = "Number of devices that failed."]
    #[serde(rename = "devicesFailedCount")]
    pub devices_failed_count: i64,
}
impl CloudInitiatedRollbackPolicyFailure {
    pub fn new(devices_failed_percentage: i64, devices_failed_count: i64) -> Self {
        Self {
            devices_failed_percentage,
            devices_failed_count,
        }
    }
}
#[doc = "Key-value pairs representing update compatibility information."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct Compatibility {}
impl Compatibility {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "The Device Update agent contract model."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ContractModel {
    #[doc = "The Device Update agent contract model Id of the device class. This is also used to calculate the device class Id."]
    pub id: String,
    #[doc = "The Device Update agent contract model name of the device class. Intended to be a more readable form of the contract model Id."]
    pub name: String,
}
impl ContractModel {
    pub fn new(id: String, name: String) -> Self {
        Self { id, name }
    }
}
#[doc = "Deployment metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Deployment {
    #[doc = "The caller-provided deployment identifier."]
    #[serde(rename = "deploymentId")]
    pub deployment_id: String,
    #[doc = "The deployment start datetime."]
    #[serde(rename = "startDateTime", with = "azure_core::date::rfc3339")]
    pub start_date_time: time::OffsetDateTime,
    #[doc = "Update information."]
    pub update: UpdateInfo,
    #[doc = "The group identity for the devices the deployment is intended to update."]
    #[serde(rename = "groupId")]
    pub group_id: String,
    #[doc = "The device class subgroups the deployment is compatible with and subgroup deployments have been created for. This is not provided by the caller during CreateOrUpdateDeployment but is automatically determined by Device Update"]
    #[serde(
        rename = "deviceClassSubgroups",
        default,
        deserialize_with = "azure_core::util::deserialize_null_as_default",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub device_class_subgroups: Vec<String>,
    #[doc = "Boolean flag indicating whether the deployment was canceled."]
    #[serde(rename = "isCanceled", default, skip_serializing_if = "Option::is_none")]
    pub is_canceled: Option<bool>,
    #[doc = "Boolean flag indicating whether the deployment has been retried."]
    #[serde(rename = "isRetried", default, skip_serializing_if = "Option::is_none")]
    pub is_retried: Option<bool>,
    #[doc = "Rollback policy for deployment"]
    #[serde(rename = "rollbackPolicy", default, skip_serializing_if = "Option::is_none")]
    pub rollback_policy: Option<CloudInitiatedRollbackPolicy>,
    #[doc = "Boolean flag indicating whether the deployment is a rollback deployment."]
    #[serde(rename = "isCloudInitiatedRollback", default, skip_serializing_if = "Option::is_none")]
    pub is_cloud_initiated_rollback: Option<bool>,
}
impl Deployment {
    pub fn new(deployment_id: String, start_date_time: time::OffsetDateTime, update: UpdateInfo, group_id: String) -> Self {
        Self {
            deployment_id,
            start_date_time,
            update,
            group_id,
            device_class_subgroups: Vec::new(),
            is_canceled: None,
            is_retried: None,
            rollback_policy: None,
            is_cloud_initiated_rollback: None,
        }
    }
}
#[doc = "Deployment device status."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeploymentDeviceState {
    #[doc = "Device identity."]
    #[serde(rename = "deviceId")]
    pub device_id: String,
    #[doc = "Device module identity."]
    #[serde(rename = "moduleId", default, skip_serializing_if = "Option::is_none")]
    pub module_id: Option<String>,
    #[doc = "The number of times this deployment has been retried on this device."]
    #[serde(rename = "retryCount")]
    pub retry_count: i32,
    #[doc = "Boolean flag indicating whether this device is in a newer deployment and can no longer retry this deployment."]
    #[serde(rename = "movedOnToNewDeployment")]
    pub moved_on_to_new_deployment: bool,
    #[doc = "Deployment state."]
    #[serde(rename = "deviceState")]
    pub device_state: DeviceDeploymentState,
}
impl DeploymentDeviceState {
    pub fn new(device_id: String, retry_count: i32, moved_on_to_new_deployment: bool, device_state: DeviceDeploymentState) -> Self {
        Self {
            device_id,
            module_id: None,
            retry_count,
            moved_on_to_new_deployment,
            device_state,
        }
    }
}
#[doc = "Deployment device state filter."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct DeploymentDeviceStatesFilter {
    #[doc = "Device Identifier."]
    #[serde(rename = "deviceId", default, skip_serializing_if = "Option::is_none")]
    pub device_id: Option<String>,
    #[doc = "Device module Identifier."]
    #[serde(rename = "moduleId", default, skip_serializing_if = "Option::is_none")]
    pub module_id: Option<String>,
    #[doc = "The deployment device state."]
    #[serde(rename = "deviceState", default, skip_serializing_if = "Option::is_none")]
    pub device_state: Option<DeviceState>,
}
impl DeploymentDeviceStatesFilter {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "The list of deployment device states."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeploymentDeviceStatesList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<DeploymentDeviceState>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for DeploymentDeviceStatesList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl DeploymentDeviceStatesList {
    pub fn new(value: Vec<DeploymentDeviceState>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "Deployment order by."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct DeploymentOrderBy {
    #[doc = "The deployment start datetime."]
    #[serde(rename = "startDateTime", default, with = "azure_core::date::rfc3339::option")]
    pub start_date_time: Option<time::OffsetDateTime>,
}
impl DeploymentOrderBy {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "Deployment state."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "DeploymentState")]
pub enum DeploymentState {
    Active,
    ActiveWithSubgroupFailures,
    Failed,
    Inactive,
    Canceled,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for DeploymentState {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for DeploymentState {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for DeploymentState {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::Active => serializer.serialize_unit_variant("DeploymentState", 0u32, "Active"),
            Self::ActiveWithSubgroupFailures => serializer.serialize_unit_variant("DeploymentState", 1u32, "ActiveWithSubgroupFailures"),
            Self::Failed => serializer.serialize_unit_variant("DeploymentState", 2u32, "Failed"),
            Self::Inactive => serializer.serialize_unit_variant("DeploymentState", 3u32, "Inactive"),
            Self::Canceled => serializer.serialize_unit_variant("DeploymentState", 4u32, "Canceled"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "Deployment status metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeploymentStatus {
    #[doc = "The group identity"]
    #[serde(rename = "groupId")]
    pub group_id: String,
    #[doc = "Deployment state."]
    #[serde(rename = "deploymentState")]
    pub deployment_state: DeploymentState,
    #[doc = "Error details."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub error: Option<Error>,
    #[doc = "The collection of device class subgroup status objects"]
    #[serde(rename = "subgroupStatus")]
    pub subgroup_status: Vec<DeviceClassSubgroupDeploymentStatus>,
}
impl DeploymentStatus {
    pub fn new(group_id: String, deployment_state: DeploymentState, subgroup_status: Vec<DeviceClassSubgroupDeploymentStatus>) -> Self {
        Self {
            group_id,
            deployment_state,
            error: None,
            subgroup_status,
        }
    }
}
#[doc = "The list of deployments."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeploymentsList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<Deployment>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for DeploymentsList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl DeploymentsList {
    pub fn new(value: Vec<Deployment>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "Device metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Device {
    #[doc = "Device identity."]
    #[serde(rename = "deviceId")]
    pub device_id: String,
    #[doc = "Device module identity."]
    #[serde(rename = "moduleId", default, skip_serializing_if = "Option::is_none")]
    pub module_id: Option<String>,
    #[doc = "Device class identity."]
    #[serde(rename = "deviceClassId")]
    pub device_class_id: String,
    #[doc = "Device group identity."]
    #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")]
    pub group_id: Option<String>,
    #[doc = "Update information."]
    #[serde(rename = "lastAttemptedUpdate", default, skip_serializing_if = "Option::is_none")]
    pub last_attempted_update: Option<UpdateInfo>,
    #[doc = "Deployment state."]
    #[serde(rename = "deploymentStatus", default, skip_serializing_if = "Option::is_none")]
    pub deployment_status: Option<DeviceDeploymentState>,
    #[doc = "Update information."]
    #[serde(rename = "installedUpdate", default, skip_serializing_if = "Option::is_none")]
    pub installed_update: Option<UpdateInfo>,
    #[doc = "Boolean flag indicating whether the latest update is installed on the device"]
    #[serde(rename = "onLatestUpdate")]
    pub on_latest_update: bool,
    #[doc = "The deployment identifier for the last deployment to the device"]
    #[serde(rename = "lastDeploymentId", default, skip_serializing_if = "Option::is_none")]
    pub last_deployment_id: Option<String>,
    #[doc = "The install result of an update and any step results under it."]
    #[serde(rename = "lastInstallResult", default, skip_serializing_if = "Option::is_none")]
    pub last_install_result: Option<InstallResult>,
}
impl Device {
    pub fn new(device_id: String, device_class_id: String, on_latest_update: bool) -> Self {
        Self {
            device_id,
            module_id: None,
            device_class_id,
            group_id: None,
            last_attempted_update: None,
            deployment_status: None,
            installed_update: None,
            on_latest_update,
            last_deployment_id: None,
            last_install_result: None,
        }
    }
}
#[doc = "Device class metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceClass {
    #[doc = "The device class identifier."]
    #[serde(rename = "deviceClassId")]
    pub device_class_id: String,
    #[doc = "The device class friendly name. This can be updated by callers after the device class has been automatically created."]
    #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")]
    pub friendly_name: Option<String>,
    #[doc = "The device class properties that are used to calculate the device class Id"]
    #[serde(rename = "deviceClassProperties")]
    pub device_class_properties: DeviceClassProperties,
    #[doc = "Update information."]
    #[serde(rename = "bestCompatibleUpdate", default, skip_serializing_if = "Option::is_none")]
    pub best_compatible_update: Option<UpdateInfo>,
}
impl DeviceClass {
    pub fn new(device_class_id: String, device_class_properties: DeviceClassProperties) -> Self {
        Self {
            device_class_id,
            friendly_name: None,
            device_class_properties,
            best_compatible_update: None,
        }
    }
}
#[doc = "The device class properties that are used to calculate the device class Id"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceClassProperties {
    #[doc = "The Device Update agent contract model."]
    #[serde(rename = "contractModel", default, skip_serializing_if = "Option::is_none")]
    pub contract_model: Option<ContractModel>,
    #[doc = "The compat properties of the device class. This object can be thought of as a set of key-value pairs where the key is the name of the compatibility property and the value is the value of the compatibility property. There will always be at least 1 compat property"]
    #[serde(rename = "compatProperties")]
    pub compat_properties: serde_json::Value,
}
impl DeviceClassProperties {
    pub fn new(compat_properties: serde_json::Value) -> Self {
        Self {
            contract_model: None,
            compat_properties,
        }
    }
}
#[doc = "Device class subgroup details. A device class subgroup is a subset of devices in a group that share the same device class id."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceClassSubgroup {
    #[doc = "Device class subgroup identity."]
    #[serde(rename = "deviceClassId")]
    pub device_class_id: String,
    #[doc = "Group identity."]
    #[serde(rename = "groupId")]
    pub group_id: String,
    #[doc = "Date and time when the device class subgroup was created."]
    #[serde(rename = "createdDateTime")]
    pub created_date_time: String,
    #[doc = "The number of devices in the device class subgroup."]
    #[serde(rename = "deviceCount", default, skip_serializing_if = "Option::is_none")]
    pub device_count: Option<i64>,
    #[doc = "The active deployment Id for the device class subgroup."]
    #[serde(rename = "deploymentId", default, skip_serializing_if = "Option::is_none")]
    pub deployment_id: Option<String>,
}
impl DeviceClassSubgroup {
    pub fn new(device_class_id: String, group_id: String, created_date_time: String) -> Self {
        Self {
            device_class_id,
            group_id,
            created_date_time,
            device_count: None,
            deployment_id: None,
        }
    }
}
#[doc = "Device class subgroup deployment state."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "DeviceClassSubgroupDeploymentState")]
pub enum DeviceClassSubgroupDeploymentState {
    Active,
    Failed,
    Inactive,
    Canceled,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for DeviceClassSubgroupDeploymentState {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for DeviceClassSubgroupDeploymentState {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for DeviceClassSubgroupDeploymentState {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::Active => serializer.serialize_unit_variant("DeviceClassSubgroupDeploymentState", 0u32, "Active"),
            Self::Failed => serializer.serialize_unit_variant("DeviceClassSubgroupDeploymentState", 1u32, "Failed"),
            Self::Inactive => serializer.serialize_unit_variant("DeviceClassSubgroupDeploymentState", 2u32, "Inactive"),
            Self::Canceled => serializer.serialize_unit_variant("DeviceClassSubgroupDeploymentState", 3u32, "Canceled"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "Device class subgroup deployment status metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceClassSubgroupDeploymentStatus {
    #[doc = "The group identity"]
    #[serde(rename = "groupId")]
    pub group_id: String,
    #[doc = "The device class subgroup identity"]
    #[serde(rename = "deviceClassId")]
    pub device_class_id: String,
    #[doc = "Device class subgroup deployment state."]
    #[serde(rename = "deploymentState")]
    pub deployment_state: DeviceClassSubgroupDeploymentState,
    #[doc = "Error details."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub error: Option<Error>,
    #[doc = "The total number of devices in the deployment."]
    #[serde(rename = "totalDevices", default, skip_serializing_if = "Option::is_none")]
    pub total_devices: Option<i32>,
    #[doc = "The number of devices that are currently in deployment."]
    #[serde(rename = "devicesInProgressCount", default, skip_serializing_if = "Option::is_none")]
    pub devices_in_progress_count: Option<i32>,
    #[doc = "The number of devices that have completed deployment with a failure."]
    #[serde(rename = "devicesCompletedFailedCount", default, skip_serializing_if = "Option::is_none")]
    pub devices_completed_failed_count: Option<i32>,
    #[doc = "The number of devices which have successfully completed deployment."]
    #[serde(rename = "devicesCompletedSucceededCount", default, skip_serializing_if = "Option::is_none")]
    pub devices_completed_succeeded_count: Option<i32>,
    #[doc = "The number of devices which have had their deployment canceled."]
    #[serde(rename = "devicesCanceledCount", default, skip_serializing_if = "Option::is_none")]
    pub devices_canceled_count: Option<i32>,
}
impl DeviceClassSubgroupDeploymentStatus {
    pub fn new(group_id: String, device_class_id: String, deployment_state: DeviceClassSubgroupDeploymentState) -> Self {
        Self {
            group_id,
            device_class_id,
            deployment_state,
            error: None,
            total_devices: None,
            devices_in_progress_count: None,
            devices_completed_failed_count: None,
            devices_completed_succeeded_count: None,
            devices_canceled_count: None,
        }
    }
}
#[doc = "Device class subgroups filter. Filters device class subgroups based on device class compat property names and values"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct DeviceClassSubgroupFilter {
    #[doc = "The name of the compat property to use in the filter. E.g. compatProperties/manufacturer"]
    #[serde(rename = "compatPropertyName", default, skip_serializing_if = "Option::is_none")]
    pub compat_property_name: Option<String>,
    #[doc = "The value the compat property to use in the filter. E.g. Contoso"]
    #[serde(rename = "compatPropertyValue", default, skip_serializing_if = "Option::is_none")]
    pub compat_property_value: Option<String>,
}
impl DeviceClassSubgroupFilter {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "Device class subgroup, update information, and the number of devices for which the update is applicable."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceClassSubgroupUpdatableDevices {
    #[doc = "The group Id"]
    #[serde(rename = "groupId")]
    pub group_id: String,
    #[doc = "The device class subgroup's device class Id"]
    #[serde(rename = "deviceClassId")]
    pub device_class_id: String,
    #[doc = "Update information."]
    pub update: UpdateInfo,
    #[doc = "Total number of devices for which the update is applicable."]
    #[serde(rename = "deviceCount")]
    pub device_count: i64,
}
impl DeviceClassSubgroupUpdatableDevices {
    pub fn new(group_id: String, device_class_id: String, update: UpdateInfo, device_count: i64) -> Self {
        Self {
            group_id,
            device_class_id,
            update,
            device_count,
        }
    }
}
#[doc = "The list of updatable devices for a device class subgroup."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceClassSubgroupUpdatableDevicesList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<DeviceClassSubgroupUpdatableDevices>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for DeviceClassSubgroupUpdatableDevicesList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl DeviceClassSubgroupUpdatableDevicesList {
    pub fn new(value: Vec<DeviceClassSubgroupUpdatableDevices>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "The list of device class subgroups within a group."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceClassSubgroupsList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<DeviceClassSubgroup>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for DeviceClassSubgroupsList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl DeviceClassSubgroupsList {
    pub fn new(value: Vec<DeviceClassSubgroup>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "The list of device classes."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceClassesList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<DeviceClass>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for DeviceClassesList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl DeviceClassesList {
    pub fn new(value: Vec<DeviceClass>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "Deployment state."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "DeviceDeploymentState")]
pub enum DeviceDeploymentState {
    Succeeded,
    InProgress,
    Canceled,
    Failed,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for DeviceDeploymentState {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for DeviceDeploymentState {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for DeviceDeploymentState {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::Succeeded => serializer.serialize_unit_variant("DeviceDeploymentState", 0u32, "Succeeded"),
            Self::InProgress => serializer.serialize_unit_variant("DeviceDeploymentState", 1u32, "InProgress"),
            Self::Canceled => serializer.serialize_unit_variant("DeviceDeploymentState", 2u32, "Canceled"),
            Self::Failed => serializer.serialize_unit_variant("DeviceDeploymentState", 3u32, "Failed"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "Device filter."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct DeviceFilter {
    #[doc = "Device group identity."]
    #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")]
    pub group_id: Option<String>,
    #[doc = "Device class identity."]
    #[serde(rename = "deviceClassId", default, skip_serializing_if = "Option::is_none")]
    pub device_class_id: Option<String>,
    #[doc = "Deployment state."]
    #[serde(rename = "deploymentStatus", default, skip_serializing_if = "Option::is_none")]
    pub deployment_status: Option<DeviceDeploymentState>,
}
impl DeviceFilter {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "Device Health"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceHealth {
    #[doc = "Device id"]
    #[serde(rename = "deviceId")]
    pub device_id: String,
    #[doc = "Module id"]
    #[serde(rename = "moduleId", default, skip_serializing_if = "Option::is_none")]
    pub module_id: Option<String>,
    #[doc = "Device health states"]
    pub state: DeviceHealthState,
    #[doc = "Digital twin model Id"]
    #[serde(rename = "digitalTwinModelId", default, skip_serializing_if = "Option::is_none")]
    pub digital_twin_model_id: Option<String>,
    #[doc = "Array of health checks and their results"]
    #[serde(rename = "healthChecks")]
    pub health_checks: Vec<HealthCheck>,
}
impl DeviceHealth {
    pub fn new(device_id: String, state: DeviceHealthState, health_checks: Vec<HealthCheck>) -> Self {
        Self {
            device_id,
            module_id: None,
            state,
            digital_twin_model_id: None,
            health_checks,
        }
    }
}
#[doc = "Device health filter."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct DeviceHealthFilter {
    #[doc = "Device health states"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub state: Option<DeviceHealthState>,
    #[doc = "Device Id"]
    #[serde(rename = "deviceId", default, skip_serializing_if = "Option::is_none")]
    pub device_id: Option<String>,
    #[doc = "Module Id"]
    #[serde(rename = "moduleId", default, skip_serializing_if = "Option::is_none")]
    pub module_id: Option<String>,
}
impl DeviceHealthFilter {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "Array of Device Health, with server paging support."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceHealthList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<DeviceHealth>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for DeviceHealthList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl DeviceHealthList {
    pub fn new(value: Vec<DeviceHealth>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "Device health states"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "DeviceHealthState")]
pub enum DeviceHealthState {
    #[serde(rename = "healthy")]
    Healthy,
    #[serde(rename = "unhealthy")]
    Unhealthy,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for DeviceHealthState {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for DeviceHealthState {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for DeviceHealthState {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::Healthy => serializer.serialize_unit_variant("DeviceHealthState", 0u32, "healthy"),
            Self::Unhealthy => serializer.serialize_unit_variant("DeviceHealthState", 1u32, "unhealthy"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "Operation metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceOperation {
    #[doc = "Operation Id."]
    #[serde(rename = "operationId")]
    pub operation_id: String,
    #[doc = "Operation status."]
    pub status: OperationStatus,
    #[doc = "Error details."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub error: Option<Error>,
    #[doc = "Operation correlation identity that can used by Microsoft Support for troubleshooting."]
    #[serde(rename = "traceId", default, skip_serializing_if = "Option::is_none")]
    pub trace_id: Option<String>,
    #[doc = "Date and time in UTC when the operation status was last updated."]
    #[serde(rename = "lastActionDateTime", with = "azure_core::date::rfc3339")]
    pub last_action_date_time: time::OffsetDateTime,
    #[doc = "Date and time in UTC when the operation was created."]
    #[serde(rename = "createdDateTime", with = "azure_core::date::rfc3339")]
    pub created_date_time: time::OffsetDateTime,
    #[doc = "Operation ETag."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub etag: Option<String>,
}
impl DeviceOperation {
    pub fn new(
        operation_id: String,
        status: OperationStatus,
        last_action_date_time: time::OffsetDateTime,
        created_date_time: time::OffsetDateTime,
    ) -> Self {
        Self {
            operation_id,
            status,
            error: None,
            trace_id: None,
            last_action_date_time,
            created_date_time,
            etag: None,
        }
    }
}
#[doc = "The list of device operations with server paging support."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceOperationsList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<DeviceOperation>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for DeviceOperationsList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl DeviceOperationsList {
    pub fn new(value: Vec<DeviceOperation>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "The deployment device state."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "DeviceState")]
pub enum DeviceState {
    NotStarted,
    Incompatible,
    AlreadyInDeployment,
    Canceled,
    InProgress,
    Failed,
    Succeeded,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for DeviceState {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for DeviceState {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for DeviceState {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::NotStarted => serializer.serialize_unit_variant("DeviceState", 0u32, "NotStarted"),
            Self::Incompatible => serializer.serialize_unit_variant("DeviceState", 1u32, "Incompatible"),
            Self::AlreadyInDeployment => serializer.serialize_unit_variant("DeviceState", 2u32, "AlreadyInDeployment"),
            Self::Canceled => serializer.serialize_unit_variant("DeviceState", 3u32, "Canceled"),
            Self::InProgress => serializer.serialize_unit_variant("DeviceState", 4u32, "InProgress"),
            Self::Failed => serializer.serialize_unit_variant("DeviceState", 5u32, "Failed"),
            Self::Succeeded => serializer.serialize_unit_variant("DeviceState", 6u32, "Succeeded"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "Device Update agent id"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceUpdateAgentId {
    #[doc = "Device Id"]
    #[serde(rename = "deviceId")]
    pub device_id: String,
    #[doc = "Module Id"]
    #[serde(rename = "moduleId", default, skip_serializing_if = "Option::is_none")]
    pub module_id: Option<String>,
}
impl DeviceUpdateAgentId {
    pub fn new(device_id: String) -> Self {
        Self {
            device_id,
            module_id: None,
        }
    }
}
#[doc = "The list of devices."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DevicesList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<Device>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for DevicesList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl DevicesList {
    pub fn new(value: Vec<Device>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "Error details."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Error {
    #[doc = "Server defined error code."]
    pub code: String,
    #[doc = "A human-readable representation of the error."]
    pub message: String,
    #[doc = "The target of the error."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub target: Option<String>,
    #[doc = "An array of errors that led to the reported error."]
    #[serde(
        default,
        deserialize_with = "azure_core::util::deserialize_null_as_default",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub details: Vec<Error>,
    #[doc = "An object containing more specific information than the current object about the error."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub innererror: Option<InnerError>,
    #[doc = "Date and time in UTC when the error occurred."]
    #[serde(rename = "occurredDateTime", default, with = "azure_core::date::rfc3339::option")]
    pub occurred_date_time: Option<time::OffsetDateTime>,
}
impl Error {
    pub fn new(code: String, message: String) -> Self {
        Self {
            code,
            message,
            target: None,
            details: Vec::new(),
            innererror: None,
            occurred_date_time: None,
        }
    }
}
#[doc = "Common error response."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ErrorResponse {
    #[doc = "Error details."]
    pub error: Error,
}
impl azure_core::Continuable for ErrorResponse {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        None
    }
}
impl ErrorResponse {
    pub fn new(error: Error) -> Self {
        Self { error }
    }
}
#[doc = "Metadata describing an update file."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct FileImportMetadata {
    #[doc = "Update file name as specified inside import manifest."]
    pub filename: String,
    #[doc = "Azure Blob location from which the update file can be downloaded by Device Update for IoT Hub. This is typically a read-only SAS-protected blob URL with an expiration set to at least 4 hours."]
    pub url: String,
}
impl FileImportMetadata {
    pub fn new(filename: String, url: String) -> Self {
        Self { filename, url }
    }
}
#[doc = "Group details."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Group {
    #[doc = "Group identity."]
    #[serde(rename = "groupId")]
    pub group_id: String,
    #[doc = "Supported group types."]
    #[serde(rename = "groupType")]
    pub group_type: GroupType,
    #[doc = "Date and time when the update was created."]
    #[serde(rename = "createdDateTime")]
    pub created_date_time: String,
    #[doc = "The number of devices in the group."]
    #[serde(rename = "deviceCount", default, skip_serializing_if = "Option::is_none")]
    pub device_count: Option<i64>,
    #[doc = "The count of subgroups with new updates available."]
    #[serde(rename = "subgroupsWithNewUpdatesAvailableCount", default, skip_serializing_if = "Option::is_none")]
    pub subgroups_with_new_updates_available_count: Option<i64>,
    #[doc = "The count of subgroups with updates in progress."]
    #[serde(rename = "subgroupsWithUpdatesInProgressCount", default, skip_serializing_if = "Option::is_none")]
    pub subgroups_with_updates_in_progress_count: Option<i64>,
    #[doc = "The count of subgroups with devices on the latest update."]
    #[serde(rename = "subgroupsWithOnLatestUpdateCount", default, skip_serializing_if = "Option::is_none")]
    pub subgroups_with_on_latest_update_count: Option<i64>,
    #[doc = "The active deployment Ids for the group"]
    #[serde(
        default,
        deserialize_with = "azure_core::util::deserialize_null_as_default",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub deployments: Vec<String>,
}
impl Group {
    pub fn new(group_id: String, group_type: GroupType, created_date_time: String) -> Self {
        Self {
            group_id,
            group_type,
            created_date_time,
            device_count: None,
            subgroups_with_new_updates_available_count: None,
            subgroups_with_updates_in_progress_count: None,
            subgroups_with_on_latest_update_count: None,
            deployments: Vec::new(),
        }
    }
}
#[doc = "Groups order by."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct GroupOrderBy {
    #[doc = "The group Id."]
    #[serde(rename = "groupId", default, skip_serializing_if = "Option::is_none")]
    pub group_id: Option<String>,
    #[doc = "The group device count."]
    #[serde(rename = "deviceCount", default, skip_serializing_if = "Option::is_none")]
    pub device_count: Option<String>,
    #[doc = "The group created date."]
    #[serde(rename = "createdDate", default, skip_serializing_if = "Option::is_none")]
    pub created_date: Option<String>,
    #[doc = "The number of subgroups with new updates available"]
    #[serde(rename = "subgroupsWithNewUpdatesAvailableCount", default, skip_serializing_if = "Option::is_none")]
    pub subgroups_with_new_updates_available_count: Option<String>,
    #[doc = "The number of subgroups with updates in progress"]
    #[serde(rename = "subgroupsWithUpdatesInProgressCount", default, skip_serializing_if = "Option::is_none")]
    pub subgroups_with_updates_in_progress_count: Option<String>,
    #[doc = "The number of subgroups with devices on the latest update"]
    #[serde(rename = "subgroupsOnLatestUpdateCount", default, skip_serializing_if = "Option::is_none")]
    pub subgroups_on_latest_update_count: Option<String>,
}
impl GroupOrderBy {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "Supported group types."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "GroupType")]
pub enum GroupType {
    IoTHubTag,
    DefaultNoTag,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for GroupType {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for GroupType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for GroupType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::IoTHubTag => serializer.serialize_unit_variant("GroupType", 0u32, "IoTHubTag"),
            Self::DefaultNoTag => serializer.serialize_unit_variant("GroupType", 1u32, "DefaultNoTag"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "The list of groups."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct GroupsList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<Group>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for GroupsList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl GroupsList {
    pub fn new(value: Vec<Group>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "Health check"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct HealthCheck {
    #[doc = "Health check name"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[doc = "Health check result"]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub result: Option<HealthCheckResult>,
}
impl HealthCheck {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "Health check result"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "HealthCheckResult")]
pub enum HealthCheckResult {
    #[serde(rename = "success")]
    Success,
    #[serde(rename = "userError")]
    UserError,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for HealthCheckResult {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for HealthCheckResult {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for HealthCheckResult {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::Success => serializer.serialize_unit_variant("HealthCheckResult", 0u32, "success"),
            Self::UserError => serializer.serialize_unit_variant("HealthCheckResult", 1u32, "userError"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "Metadata describing the import manifest, a document which describes the files and other metadata about an update version."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ImportManifestMetadata {
    #[doc = "Azure Blob location from which the import manifest can be downloaded by Device Update for IoT Hub. This is typically a read-only SAS-protected blob URL with an expiration set to at least 4 hours."]
    pub url: String,
    #[doc = "File size in number of bytes."]
    #[serde(rename = "sizeInBytes")]
    pub size_in_bytes: i64,
    #[doc = "A JSON object containing the hash(es) of the file. At least SHA256 hash is required. This object can be thought of as a set of key-value pairs where the key is the hash algorithm, and the value is the hash of the file calculated using that algorithm."]
    pub hashes: serde_json::Value,
}
impl ImportManifestMetadata {
    pub fn new(url: String, size_in_bytes: i64, hashes: serde_json::Value) -> Self {
        Self {
            url,
            size_in_bytes,
            hashes,
        }
    }
}
#[doc = "The device import type."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "ImportType")]
pub enum ImportType {
    Devices,
    Modules,
    All,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for ImportType {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for ImportType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for ImportType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::Devices => serializer.serialize_unit_variant("ImportType", 0u32, "Devices"),
            Self::Modules => serializer.serialize_unit_variant("ImportType", 1u32, "Modules"),
            Self::All => serializer.serialize_unit_variant("ImportType", 2u32, "All"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
pub type ImportUpdateInput = Vec<ImportUpdateInputItem>;
#[doc = "Import update input item metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ImportUpdateInputItem {
    #[doc = "Metadata describing the import manifest, a document which describes the files and other metadata about an update version."]
    #[serde(rename = "importManifest")]
    pub import_manifest: ImportManifestMetadata,
    #[doc = "Friendly update name."]
    #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")]
    pub friendly_name: Option<String>,
    #[doc = "One or more update file properties like filename and source URL."]
    #[serde(
        default,
        deserialize_with = "azure_core::util::deserialize_null_as_default",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub files: Vec<FileImportMetadata>,
}
impl ImportUpdateInputItem {
    pub fn new(import_manifest: ImportManifestMetadata) -> Self {
        Self {
            import_manifest,
            friendly_name: None,
            files: Vec::new(),
        }
    }
}
#[doc = "An object containing more specific information than the current object about the error."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct InnerError {
    #[doc = "A more specific error code than what was provided by the containing error."]
    pub code: String,
    #[doc = "A human-readable representation of the error."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    #[doc = "The internal error or exception message."]
    #[serde(rename = "errorDetail", default, skip_serializing_if = "Option::is_none")]
    pub error_detail: Option<String>,
    #[doc = "An object containing more specific information than the current object about the error."]
    #[serde(rename = "innerError", default, skip_serializing_if = "Option::is_none")]
    pub inner_error: Box<Option<InnerError>>,
}
impl InnerError {
    pub fn new(code: String) -> Self {
        Self {
            code,
            message: None,
            error_detail: None,
            inner_error: Box::new(None),
        }
    }
}
#[doc = "The install result of an update and any step results under it."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct InstallResult {
    #[doc = "Install result code."]
    #[serde(rename = "resultCode")]
    pub result_code: i64,
    #[doc = "Install extended result code"]
    #[serde(rename = "extendedResultCode")]
    pub extended_result_code: i64,
    #[doc = "A string containing further details about the install result"]
    #[serde(rename = "resultDetails", default, skip_serializing_if = "Option::is_none")]
    pub result_details: Option<String>,
    #[doc = "Array of step results"]
    #[serde(
        rename = "stepResults",
        default,
        deserialize_with = "azure_core::util::deserialize_null_as_default",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub step_results: Vec<StepResult>,
}
impl InstallResult {
    pub fn new(result_code: i64, extended_result_code: i64) -> Self {
        Self {
            result_code,
            extended_result_code,
            result_details: None,
            step_results: Vec::new(),
        }
    }
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Instructions {
    #[doc = "Collection of installation steps."]
    pub steps: Vec<Step>,
}
impl Instructions {
    pub fn new(steps: Vec<Step>) -> Self {
        Self { steps }
    }
}
#[doc = "Diagnostics request body"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogCollection {
    #[doc = "The log collection id."]
    #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")]
    pub operation_id: Option<String>,
    #[doc = "Array of Device Update agent ids"]
    #[serde(rename = "deviceList")]
    pub device_list: Vec<DeviceUpdateAgentId>,
    #[doc = "Description of the diagnostics operation."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[doc = "The timestamp when the operation was created."]
    #[serde(rename = "createdDateTime", default, skip_serializing_if = "Option::is_none")]
    pub created_date_time: Option<String>,
    #[doc = "A timestamp for when the current state was entered."]
    #[serde(rename = "lastActionDateTime", default, skip_serializing_if = "Option::is_none")]
    pub last_action_date_time: Option<String>,
    #[doc = "Operation status."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<OperationStatusWithoutUndefinedOption>,
}
impl LogCollection {
    pub fn new(device_list: Vec<DeviceUpdateAgentId>) -> Self {
        Self {
            operation_id: None,
            device_list,
            description: None,
            created_date_time: None,
            last_action_date_time: None,
            status: None,
        }
    }
}
#[doc = "The list of log collections with detailed status, with server paging support."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogCollectionDetailedStatusList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<LogCollectionOperationDetailedStatus>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl LogCollectionDetailedStatusList {
    pub fn new(value: Vec<LogCollectionOperationDetailedStatus>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "The list of log collections with server paging support."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogCollectionList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<LogCollection>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for LogCollectionList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl LogCollectionList {
    pub fn new(value: Vec<LogCollection>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "Device diagnostics operation detailed status"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct LogCollectionOperationDetailedStatus {
    #[doc = "The device diagnostics operation id."]
    #[serde(rename = "operationId", default, skip_serializing_if = "Option::is_none")]
    pub operation_id: Option<String>,
    #[doc = "The timestamp when the operation was created."]
    #[serde(rename = "createdDateTime", default, skip_serializing_if = "Option::is_none")]
    pub created_date_time: Option<String>,
    #[doc = "A timestamp for when the current state was entered."]
    #[serde(rename = "lastActionDateTime", default, skip_serializing_if = "Option::is_none")]
    pub last_action_date_time: Option<String>,
    #[doc = "Operation status."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<OperationStatusWithoutUndefinedOption>,
    #[doc = "Status of the devices in the operation"]
    #[serde(
        rename = "deviceStatus",
        default,
        deserialize_with = "azure_core::util::deserialize_null_as_default",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub device_status: Vec<LogCollectionOperationDeviceStatus>,
    #[doc = "Device diagnostics operation description."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
}
impl LogCollectionOperationDetailedStatus {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "Diagnostics operation device status"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogCollectionOperationDeviceStatus {
    #[doc = "Device id"]
    #[serde(rename = "deviceId")]
    pub device_id: String,
    #[doc = "Module id."]
    #[serde(rename = "moduleId", default, skip_serializing_if = "Option::is_none")]
    pub module_id: Option<String>,
    #[doc = "Operation status."]
    pub status: OperationStatusWithoutUndefinedOption,
    #[doc = "Log upload result code"]
    #[serde(rename = "resultCode", default, skip_serializing_if = "Option::is_none")]
    pub result_code: Option<String>,
    #[doc = "Log upload extended result code"]
    #[serde(rename = "extendedResultCode", default, skip_serializing_if = "Option::is_none")]
    pub extended_result_code: Option<String>,
    #[doc = "Log upload location"]
    #[serde(rename = "logLocation", default, skip_serializing_if = "Option::is_none")]
    pub log_location: Option<String>,
}
impl LogCollectionOperationDeviceStatus {
    pub fn new(device_id: String, status: OperationStatusWithoutUndefinedOption) -> Self {
        Self {
            device_id,
            module_id: None,
            status,
            result_code: None,
            extended_result_code: None,
            log_location: None,
        }
    }
}
#[doc = "Operation status filter."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct OperationFilter {
    #[doc = "Operation status filter."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub status: Option<OperationFilterStatus>,
}
impl OperationFilter {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "Operation status filter."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "OperationFilterStatus")]
pub enum OperationFilterStatus {
    Running,
    NotStarted,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for OperationFilterStatus {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for OperationFilterStatus {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for OperationFilterStatus {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::Running => serializer.serialize_unit_variant("OperationFilterStatus", 0u32, "Running"),
            Self::NotStarted => serializer.serialize_unit_variant("OperationFilterStatus", 1u32, "NotStarted"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "Operation status."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "OperationStatus")]
pub enum OperationStatus {
    NotStarted,
    Running,
    Succeeded,
    Failed,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for OperationStatus {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for OperationStatus {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for OperationStatus {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::NotStarted => serializer.serialize_unit_variant("OperationStatus", 0u32, "NotStarted"),
            Self::Running => serializer.serialize_unit_variant("OperationStatus", 1u32, "Running"),
            Self::Succeeded => serializer.serialize_unit_variant("OperationStatus", 2u32, "Succeeded"),
            Self::Failed => serializer.serialize_unit_variant("OperationStatus", 3u32, "Failed"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "Operation status."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(remote = "OperationStatusWithoutUndefinedOption")]
pub enum OperationStatusWithoutUndefinedOption {
    NotStarted,
    Running,
    Succeeded,
    Failed,
    #[serde(skip_deserializing)]
    UnknownValue(String),
}
impl FromStr for OperationStatusWithoutUndefinedOption {
    type Err = value::Error;
    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        Self::deserialize(s.into_deserializer())
    }
}
impl<'de> Deserialize<'de> for OperationStatusWithoutUndefinedOption {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        let s = String::deserialize(deserializer)?;
        let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
        Ok(deserialized)
    }
}
impl Serialize for OperationStatusWithoutUndefinedOption {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: Serializer,
    {
        match self {
            Self::NotStarted => serializer.serialize_unit_variant("OperationStatusWithoutUndefinedOption", 0u32, "NotStarted"),
            Self::Running => serializer.serialize_unit_variant("OperationStatusWithoutUndefinedOption", 1u32, "Running"),
            Self::Succeeded => serializer.serialize_unit_variant("OperationStatusWithoutUndefinedOption", 2u32, "Succeeded"),
            Self::Failed => serializer.serialize_unit_variant("OperationStatusWithoutUndefinedOption", 3u32, "Failed"),
            Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
        }
    }
}
#[doc = "Device Class JSON Merge Patch request body"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PatchBody {
    #[doc = "The device class friendly name."]
    #[serde(rename = "friendlyName")]
    pub friendly_name: String,
}
impl PatchBody {
    pub fn new(friendly_name: String) -> Self {
        Self { friendly_name }
    }
}
#[doc = "Update install instruction step."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct Step {
    #[doc = "Step type."]
    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
    pub type_: Option<step::Type>,
    #[doc = "Step description."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[doc = "Identity of handler that will execute this step. Required if step type is inline."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub handler: Option<String>,
    #[doc = "Parameters to be passed to handler during execution."]
    #[serde(rename = "handlerProperties", default, skip_serializing_if = "Option::is_none")]
    pub handler_properties: Option<serde_json::Value>,
    #[doc = "Collection of file names to be passed to handler during execution. Required if step type is inline."]
    #[serde(
        default,
        deserialize_with = "azure_core::util::deserialize_null_as_default",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub files: Vec<String>,
    #[doc = "Update identifier."]
    #[serde(rename = "updateId", default, skip_serializing_if = "Option::is_none")]
    pub update_id: Option<UpdateId>,
}
impl Step {
    pub fn new() -> Self {
        Self::default()
    }
}
pub mod step {
    use super::*;
    #[doc = "Step type."]
    #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
    #[serde(remote = "Type")]
    pub enum Type {
        #[serde(rename = "inline")]
        Inline,
        #[serde(rename = "reference")]
        Reference,
        #[serde(skip_deserializing)]
        UnknownValue(String),
    }
    impl FromStr for Type {
        type Err = value::Error;
        fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
            Self::deserialize(s.into_deserializer())
        }
    }
    impl<'de> Deserialize<'de> for Type {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: Deserializer<'de>,
        {
            let s = String::deserialize(deserializer)?;
            let deserialized = Self::from_str(&s).unwrap_or(Self::UnknownValue(s));
            Ok(deserialized)
        }
    }
    impl Serialize for Type {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: Serializer,
        {
            match self {
                Self::Inline => serializer.serialize_unit_variant("Type", 0u32, "inline"),
                Self::Reference => serializer.serialize_unit_variant("Type", 1u32, "reference"),
                Self::UnknownValue(s) => serializer.serialize_str(s.as_str()),
            }
        }
    }
    impl Default for Type {
        fn default() -> Self {
            Self::Inline
        }
    }
}
#[doc = "The step result under an update."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StepResult {
    #[doc = "Update information."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub update: Option<UpdateInfo>,
    #[doc = "Step description."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[doc = "Install result code."]
    #[serde(rename = "resultCode")]
    pub result_code: i64,
    #[doc = "Install extended result code"]
    #[serde(rename = "extendedResultCode")]
    pub extended_result_code: i64,
    #[doc = "A string containing further details about the install result"]
    #[serde(rename = "resultDetails", default, skip_serializing_if = "Option::is_none")]
    pub result_details: Option<String>,
}
impl StepResult {
    pub fn new(result_code: i64, extended_result_code: i64) -> Self {
        Self {
            update: None,
            description: None,
            result_code,
            extended_result_code,
            result_details: None,
        }
    }
}
#[doc = "The list of strings with server paging support."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct StringsList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<String>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for StringsList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl StringsList {
    pub fn new(value: Vec<String>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "Update metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Update {
    #[doc = "Update identifier."]
    #[serde(rename = "updateId")]
    pub update_id: UpdateId,
    #[doc = "Update description specified by creator."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[doc = "Friendly update name specified by importer."]
    #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")]
    pub friendly_name: Option<String>,
    #[doc = "Whether the update can be deployed to a device on its own."]
    #[serde(rename = "isDeployable", default, skip_serializing_if = "Option::is_none")]
    pub is_deployable: Option<bool>,
    #[doc = "Update type. Deprecated in latest import manifest schema."]
    #[serde(rename = "updateType", default, skip_serializing_if = "Option::is_none")]
    pub update_type: Option<String>,
    #[doc = "String interpreted by Device Update client to determine if the update is installed on the device. Deprecated in latest import manifest schema."]
    #[serde(rename = "installedCriteria", default, skip_serializing_if = "Option::is_none")]
    pub installed_criteria: Option<String>,
    #[doc = "List of update compatibility information."]
    pub compatibility: Vec<Compatibility>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub instructions: Option<Instructions>,
    #[doc = "List of update identities that reference this update."]
    #[serde(
        rename = "referencedBy",
        default,
        deserialize_with = "azure_core::util::deserialize_null_as_default",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub referenced_by: Vec<UpdateId>,
    #[doc = "Update aggregate scan result (calculated from payload file scan results)."]
    #[serde(rename = "scanResult", default, skip_serializing_if = "Option::is_none")]
    pub scan_result: Option<String>,
    #[doc = "Schema version of manifest used to import the update."]
    #[serde(rename = "manifestVersion")]
    pub manifest_version: String,
    #[doc = "Date and time in UTC when the update was imported."]
    #[serde(rename = "importedDateTime", with = "azure_core::date::rfc3339")]
    pub imported_date_time: time::OffsetDateTime,
    #[doc = "Date and time in UTC when the update was created."]
    #[serde(rename = "createdDateTime", with = "azure_core::date::rfc3339")]
    pub created_date_time: time::OffsetDateTime,
    #[doc = "Update ETag."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub etag: Option<String>,
}
impl Update {
    pub fn new(
        update_id: UpdateId,
        compatibility: Vec<Compatibility>,
        manifest_version: String,
        imported_date_time: time::OffsetDateTime,
        created_date_time: time::OffsetDateTime,
    ) -> Self {
        Self {
            update_id,
            description: None,
            friendly_name: None,
            is_deployable: None,
            update_type: None,
            installed_criteria: None,
            compatibility,
            instructions: None,
            referenced_by: Vec::new(),
            scan_result: None,
            manifest_version,
            imported_date_time,
            created_date_time,
            etag: None,
        }
    }
}
#[doc = "Update compliance information."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateCompliance {
    #[doc = "Total number of devices."]
    #[serde(rename = "totalDeviceCount")]
    pub total_device_count: i64,
    #[doc = "Number of devices on the latest update."]
    #[serde(rename = "onLatestUpdateDeviceCount")]
    pub on_latest_update_device_count: i64,
    #[doc = "Number of devices with a newer update available."]
    #[serde(rename = "newUpdatesAvailableDeviceCount")]
    pub new_updates_available_device_count: i64,
    #[doc = "Number of devices with update in-progress."]
    #[serde(rename = "updatesInProgressDeviceCount")]
    pub updates_in_progress_device_count: i64,
}
impl UpdateCompliance {
    pub fn new(
        total_device_count: i64,
        on_latest_update_device_count: i64,
        new_updates_available_device_count: i64,
        updates_in_progress_device_count: i64,
    ) -> Self {
        Self {
            total_device_count,
            on_latest_update_device_count,
            new_updates_available_device_count,
            updates_in_progress_device_count,
        }
    }
}
#[doc = "Update file metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateFile {
    #[serde(flatten)]
    pub update_file_base: UpdateFileBase,
    #[doc = "File identity, generated by server at import time."]
    #[serde(rename = "fileId")]
    pub file_id: String,
    #[doc = "Optional related files metadata used together DownloadHandler metadata to download payload file."]
    #[serde(
        rename = "relatedFiles",
        default,
        deserialize_with = "azure_core::util::deserialize_null_as_default",
        skip_serializing_if = "Vec::is_empty"
    )]
    pub related_files: Vec<UpdateFileBase>,
    #[doc = "Download handler for utilizing related files to download payload file."]
    #[serde(rename = "downloadHandler", default, skip_serializing_if = "Option::is_none")]
    pub download_handler: Option<UpdateFileDownloadHandler>,
    #[doc = "File ETag."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub etag: Option<String>,
}
impl UpdateFile {
    pub fn new(update_file_base: UpdateFileBase, file_id: String) -> Self {
        Self {
            update_file_base,
            file_id,
            related_files: Vec::new(),
            download_handler: None,
            etag: None,
        }
    }
}
#[doc = "Update file basic metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateFileBase {
    #[doc = "File name."]
    #[serde(rename = "fileName")]
    pub file_name: String,
    #[doc = "File size in number of bytes."]
    #[serde(rename = "sizeInBytes")]
    pub size_in_bytes: i64,
    #[doc = "Mapping of hashing algorithm to base64 encoded hash values."]
    pub hashes: serde_json::Value,
    #[doc = "File MIME type."]
    #[serde(rename = "mimeType", default, skip_serializing_if = "Option::is_none")]
    pub mime_type: Option<String>,
    #[doc = "Anti-malware scan result."]
    #[serde(rename = "scanResult", default, skip_serializing_if = "Option::is_none")]
    pub scan_result: Option<String>,
    #[doc = "Anti-malware scan details."]
    #[serde(rename = "scanDetails", default, skip_serializing_if = "Option::is_none")]
    pub scan_details: Option<String>,
    #[doc = "Optional file properties (not consumed by service but pass-through to device)."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub properties: Option<serde_json::Value>,
}
impl UpdateFileBase {
    pub fn new(file_name: String, size_in_bytes: i64, hashes: serde_json::Value) -> Self {
        Self {
            file_name,
            size_in_bytes,
            hashes,
            mime_type: None,
            scan_result: None,
            scan_details: None,
            properties: None,
        }
    }
}
#[doc = "Download handler for utilizing related files to download payload file."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateFileDownloadHandler {
    #[doc = "Download handler identifier."]
    pub id: String,
}
impl UpdateFileDownloadHandler {
    pub fn new(id: String) -> Self {
        Self { id }
    }
}
#[doc = "Update filter."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct UpdateFilter {
    #[doc = "Update isDeployable property."]
    #[serde(rename = "isDeployable", default, skip_serializing_if = "Option::is_none")]
    pub is_deployable: Option<bool>,
}
impl UpdateFilter {
    pub fn new() -> Self {
        Self::default()
    }
}
#[doc = "Update identifier."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateId {
    #[doc = "Update provider."]
    pub provider: String,
    #[doc = "Update name."]
    pub name: String,
    #[doc = "Update version."]
    pub version: String,
}
impl UpdateId {
    pub fn new(provider: String, name: String, version: String) -> Self {
        Self { provider, name, version }
    }
}
#[doc = "Update information."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateInfo {
    #[doc = "Update identifier."]
    #[serde(rename = "updateId")]
    pub update_id: UpdateId,
    #[doc = "Update description."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[doc = "Friendly update name."]
    #[serde(rename = "friendlyName", default, skip_serializing_if = "Option::is_none")]
    pub friendly_name: Option<String>,
}
impl UpdateInfo {
    pub fn new(update_id: UpdateId) -> Self {
        Self {
            update_id,
            description: None,
            friendly_name: None,
        }
    }
}
#[doc = "List of update information."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateInfoList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<UpdateInfo>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for UpdateInfoList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl UpdateInfoList {
    pub fn new(value: Vec<UpdateInfo>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "The list of updates."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<Update>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for UpdateList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl UpdateList {
    pub fn new(value: Vec<Update>) -> Self {
        Self { value, next_link: None }
    }
}
#[doc = "Operation metadata."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateOperation {
    #[doc = "Operation Id."]
    #[serde(rename = "operationId")]
    pub operation_id: String,
    #[doc = "Operation status."]
    pub status: OperationStatus,
    #[doc = "Update information."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub update: Option<UpdateInfo>,
    #[doc = "Location of the imported update when operation is successful."]
    #[serde(rename = "resourceLocation", default, skip_serializing_if = "Option::is_none")]
    pub resource_location: Option<String>,
    #[doc = "Error details."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub error: Option<Error>,
    #[doc = "Operation correlation identity that can used by Microsoft Support for troubleshooting."]
    #[serde(rename = "traceId", default, skip_serializing_if = "Option::is_none")]
    pub trace_id: Option<String>,
    #[doc = "Date and time in UTC when the operation status was last updated."]
    #[serde(rename = "lastActionDateTime", with = "azure_core::date::rfc3339")]
    pub last_action_date_time: time::OffsetDateTime,
    #[doc = "Date and time in UTC when the operation was created."]
    #[serde(rename = "createdDateTime", with = "azure_core::date::rfc3339")]
    pub created_date_time: time::OffsetDateTime,
    #[doc = "Operation ETag."]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub etag: Option<String>,
}
impl UpdateOperation {
    pub fn new(
        operation_id: String,
        status: OperationStatus,
        last_action_date_time: time::OffsetDateTime,
        created_date_time: time::OffsetDateTime,
    ) -> Self {
        Self {
            operation_id,
            status,
            update: None,
            resource_location: None,
            error: None,
            trace_id: None,
            last_action_date_time,
            created_date_time,
            etag: None,
        }
    }
}
#[doc = "The list of operations with server paging support."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateOperationsList {
    #[doc = "The collection of pageable items."]
    pub value: Vec<UpdateOperation>,
    #[doc = "The link to the next page of items."]
    #[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
    pub next_link: Option<String>,
}
impl azure_core::Continuable for UpdateOperationsList {
    type Continuation = String;
    fn continuation(&self) -> Option<Self::Continuation> {
        self.next_link.clone()
    }
}
impl UpdateOperationsList {
    pub fn new(value: Vec<UpdateOperation>) -> Self {
        Self { value, next_link: None }
    }
}