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 app_types import UNSET, Unset T = TypeVar("T", bound="BuildingItem") @_attrs_define class BuildingItem: """A building or an area that groups together several plan Attributes: id (UUID): ID name (str): Name Example: Hospital. city (Union[Unset, str]): City address (Union[Unset, str]): Address latitude (Union[Unset, float]): Latitude longitude (Union[Unset, float]): Longitude """ id: UUID name: str city: Union[Unset, str] = UNSET address: Union[Unset, str] = UNSET latitude: Union[Unset, float] = UNSET longitude: Union[Unset, float] = 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 city = self.city address = self.address latitude = self.latitude longitude = self.longitude field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "id": id, "name": name, } ) if city is not UNSET: field_dict["city"] = city if address is not UNSET: field_dict["address"] = address if latitude is not UNSET: field_dict["latitude"] = latitude if longitude is not UNSET: field_dict["longitude"] = longitude 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") city = d.pop("city", UNSET) address = d.pop("address", UNSET) latitude = d.pop("latitude", UNSET) longitude = d.pop("longitude", UNSET) building_item = cls( id=id, name=name, city=city, address=address, latitude=latitude, longitude=longitude, ) building_item.additional_properties = d return building_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