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="SubjectItem") @_attrs_define class SubjectItem: """Person or object monitored by the operators Attributes: id (str): ID name (str): Name role (Union[Unset, str]): Role phone (Union[Unset, str]): Phone zones (Union[Unset, str]): Zones groups (Union[Unset, str]): Groups building (Union[Unset, UUID]): Building notes (Union[Unset, str]): Notes """ id: str name: str role: Union[Unset, str] = UNSET phone: Union[Unset, str] = UNSET zones: Union[Unset, str] = UNSET groups: Union[Unset, str] = 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 = self.id name = self.name role = self.role phone = self.phone zones = self.zones groups = self.groups 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 role is not UNSET: field_dict["role"] = role if phone is not UNSET: field_dict["phone"] = phone if zones is not UNSET: field_dict["zones"] = zones if groups is not UNSET: field_dict["groups"] = groups 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 = d.pop("id") name = d.pop("name") role = d.pop("role", UNSET) phone = d.pop("phone", UNSET) zones = d.pop("zones", UNSET) groups = d.pop("groups", UNSET) _building = d.pop("building", UNSET) building: Union[Unset, UUID] if isinstance(_building, Unset): building = UNSET else: building = UUID(_building) notes = d.pop("notes", UNSET) subject_item = cls( id=id, name=name, role=role, phone=phone, zones=zones, groups=groups, building=building, notes=notes, ) subject_item.additional_properties = d return subject_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