from collections.abc import Mapping from typing import Any, TypeVar, Union from uuid import UUID from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset T = TypeVar("T", bound="GatewayItem") @_attrs_define class GatewayItem: """A gateway of the system Attributes: id (UUID): ID name (str): Name mac (Union[Unset, str]): MAC status (Union[Unset, bool]): Status model (Union[Unset, str]): Model ip (Union[Unset, str]): IP position (Union[Unset, str]): Position x (Union[Unset, float]): X y (Union[Unset, float]): Y zone (Union[Unset, UUID]): Zone building (Union[Unset, UUID]): Building notes (Union[Unset, str]): Notes """ id: UUID name: str mac: Union[Unset, str] = UNSET status: Union[Unset, bool] = UNSET model: Union[Unset, str] = UNSET ip: Union[Unset, str] = UNSET position: Union[Unset, str] = UNSET x: Union[Unset, float] = UNSET y: Union[Unset, float] = UNSET zone: Union[Unset, UUID] = UNSET building: Union[Unset, UUID] = UNSET notes: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: id = str(self.id) name = self.name mac = self.mac status = self.status model = self.model ip = self.ip position = self.position x = self.x y = self.y zone: Union[Unset, str] = UNSET if not isinstance(self.zone, Unset): zone = str(self.zone) building: Union[Unset, str] = UNSET if not isinstance(self.building, Unset): building = str(self.building) notes = self.notes field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "id": id, "name": name, } ) if mac is not UNSET: field_dict["mac"] = mac if status is not UNSET: field_dict["status"] = status if model is not UNSET: field_dict["model"] = model if ip is not UNSET: field_dict["ip"] = ip if position is not UNSET: field_dict["position"] = position if x is not UNSET: field_dict["x"] = x if y is not UNSET: field_dict["y"] = y if zone is not UNSET: field_dict["zone"] = zone if building is not UNSET: field_dict["building"] = building if notes is not UNSET: field_dict["notes"] = notes return field_dict @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) id = UUID(d.pop("id")) name = d.pop("name") mac = d.pop("mac", UNSET) status = d.pop("status", UNSET) model = d.pop("model", UNSET) ip = d.pop("ip", UNSET) position = d.pop("position", UNSET) x = d.pop("x", UNSET) y = d.pop("y", UNSET) _zone = d.pop("zone", UNSET) zone: Union[Unset, UUID] if isinstance(_zone, Unset): zone = UNSET else: zone = UUID(_zone) _building = d.pop("building", UNSET) building: Union[Unset, UUID] if isinstance(_building, Unset): building = UNSET else: building = UUID(_building) notes = d.pop("notes", UNSET) gateway_item = cls( id=id, name=name, mac=mac, status=status, model=model, ip=ip, position=position, x=x, y=y, zone=zone, building=building, notes=notes, ) gateway_item.additional_properties = d return gateway_item @property def additional_keys(self) -> list[str]: return list(self.additional_properties.keys()) def __getitem__(self, key: str) -> Any: return self.additional_properties[key] def __setitem__(self, key: str, value: Any) -> None: self.additional_properties[key] = value def __delitem__(self, key: str) -> None: del self.additional_properties[key] def __contains__(self, key: str) -> bool: return key in self.additional_properties