No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

169 líneas
4.2 KiB

  1. from collections.abc import Mapping
  2. from typing import Any, TypeVar, Union
  3. from uuid import UUID
  4. from attrs import define as _attrs_define
  5. from attrs import field as _attrs_field
  6. from app_types import UNSET, Unset
  7. T = TypeVar("T", bound="GatewayItem")
  8. @_attrs_define
  9. class GatewayItem:
  10. """A gateway of the system
  11. Attributes:
  12. id (UUID): ID
  13. name (str): Name
  14. mac (Union[Unset, str]): MAC
  15. status (Union[Unset, bool]): Status
  16. model (Union[Unset, str]): Model
  17. ip (Union[Unset, str]): IP
  18. position (Union[Unset, str]): Position
  19. x (Union[Unset, float]): X
  20. y (Union[Unset, float]): Y
  21. floor (Union[Unset, UUID]): Zone
  22. building (Union[Unset, UUID]): Building
  23. notes (Union[Unset, str]): Notes
  24. """
  25. id: UUID
  26. name: str
  27. mac: Union[Unset, str] = UNSET
  28. status: Union[Unset, bool] = UNSET
  29. model: Union[Unset, str] = UNSET
  30. ip: Union[Unset, str] = UNSET
  31. position: Union[Unset, str] = UNSET
  32. x: Union[Unset, float] = UNSET
  33. y: Union[Unset, float] = UNSET
  34. floor: UUID = UNSET
  35. building: Union[Unset, UUID] = UNSET
  36. notes: Union[Unset, str] = UNSET
  37. additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
  38. def to_dict(self) -> dict[str, Any]:
  39. id = str(self.id)
  40. name = self.name
  41. mac = self.mac
  42. status = self.status
  43. model = self.model
  44. ip = self.ip
  45. position = self.position
  46. x = self.x
  47. y = self.y
  48. floor = self.floor
  49. building: Union[Unset, str] = UNSET
  50. if not isinstance(self.building, Unset):
  51. building = str(self.building)
  52. notes = self.notes
  53. field_dict: dict[str, Any] = {}
  54. field_dict.update(self.additional_properties)
  55. field_dict.update(
  56. {
  57. "id": id,
  58. "name": name,
  59. }
  60. )
  61. if mac is not UNSET:
  62. field_dict["mac"] = mac
  63. if status is not UNSET:
  64. field_dict["status"] = status
  65. if model is not UNSET:
  66. field_dict["model"] = model
  67. if ip is not UNSET:
  68. field_dict["ip"] = ip
  69. if position is not UNSET:
  70. field_dict["position"] = position
  71. if x is not UNSET:
  72. field_dict["x"] = x
  73. if y is not UNSET:
  74. field_dict["y"] = y
  75. if floor is not UNSET:
  76. field_dict["floor"] = floor
  77. if building is not UNSET:
  78. field_dict["building"] = building
  79. if notes is not UNSET:
  80. field_dict["notes"] = notes
  81. return field_dict
  82. @classmethod
  83. def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
  84. d = dict(src_dict)
  85. id = UUID(d.pop("id"))
  86. name = d.pop("name")
  87. mac = d.pop("mac", UNSET)
  88. status = d.pop("status", UNSET)
  89. model = d.pop("model", UNSET)
  90. ip = d.pop("ip", UNSET)
  91. position = d.pop("position", UNSET)
  92. x = d.pop("x", UNSET)
  93. y = d.pop("y", UNSET)
  94. floor = d.pop("floor", UNSET)
  95. _building = d.pop("building", UNSET)
  96. building: Union[Unset, UUID]
  97. if isinstance(_building, Unset):
  98. building = UNSET
  99. else:
  100. building = UUID(_building)
  101. notes = d.pop("notes", UNSET)
  102. gateway_item = cls(
  103. id=id,
  104. name=name,
  105. mac=mac,
  106. status=status,
  107. model=model,
  108. ip=ip,
  109. position=position,
  110. x=x,
  111. y=y,
  112. floor=floor,
  113. building=building,
  114. notes=notes,
  115. )
  116. gateway_item.additional_properties = d
  117. return gateway_item
  118. @property
  119. def additional_keys(self) -> list[str]:
  120. return list(self.additional_properties.keys())
  121. def __getitem__(self, key: str) -> Any:
  122. return self.additional_properties[key]
  123. def __setitem__(self, key: str, value: Any) -> None:
  124. self.additional_properties[key] = value
  125. def __delitem__(self, key: str) -> None:
  126. del self.additional_properties[key]
  127. def __contains__(self, key: str) -> bool:
  128. return key in self.additional_properties