33from typing import Any , Self
44
55from .authorized_role import AuthorizedRole
6+ from .device_connectivity import DeviceConnectivity
67from .device_type import DeviceType
78
89
@@ -19,6 +20,7 @@ class Device:
1920 authorized_role : AuthorizedRole
2021 manifest : dict [str , Any ] | None = None
2122 properties : dict [str , Any ] | None = None
23+ connectivity : DeviceConnectivity | None = None
2224
2325 @classmethod
2426 def from_dto (cls , dto : dict [str , Any ]) -> Self :
@@ -33,6 +35,11 @@ def from_dto(cls, dto: dict[str, Any]) -> Self:
3335 authorized_role = AuthorizedRole (dto ["authorized_role" ]),
3436 manifest = dto .get ("manifest" ),
3537 properties = dto .get ("properties" ),
38+ connectivity = (
39+ DeviceConnectivity .from_dto (dto ["connectivity" ])
40+ if dto .get ("connectivity" ) is not None
41+ else None
42+ ),
3643 )
3744
3845 def to_dto (self ) -> dict [str , Any ]:
@@ -47,4 +54,7 @@ def to_dto(self) -> dict[str, Any]:
4754 "authorized_role" : self .authorized_role .value ,
4855 "manifest" : self .manifest ,
4956 "properties" : self .properties ,
57+ "connectivity" : (
58+ self .connectivity .to_dto () if self .connectivity is not None else None
59+ ),
5060 }
0 commit comments