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="OperatorItem") @_attrs_define class OperatorItem: """An operator who monitors the subjects Attributes: id (str): ID name (str): Name phone (Union[Unset, str]): Phone zones (Union[Unset, str]): Zones groups (Union[Unset, str]): Groups notes (Union[Unset, str]): Notes building (Union[Unset, UUID]): Building """ id: str name: str phone: Union[Unset, str] = UNSET zones: Union[Unset, str] = UNSET groups: Union[Unset, str] = UNSET notes: Union[Unset, str] = UNSET building: Union[Unset, UUID] = 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 phone = self.phone zones = self.zones groups = self.groups notes = self.notes building: Union[Unset, str] = UNSET if not isinstance(self.building, Unset): building = str(self.building) field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "id": id, "name": name, } ) 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 notes is not UNSET: field_dict["notes"] = notes if building is not UNSET: field_dict["building"] = building 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") phone = d.pop("phone", UNSET) zones = d.pop("zones", UNSET) groups = d.pop("groups", UNSET) notes = d.pop("notes", UNSET) _building = d.pop("building", UNSET) building: Union[Unset, UUID] if isinstance(_building, Unset): building = UNSET else: building = UUID(_building) operator_item = cls( id=id, name=name, phone=phone, zones=zones, groups=groups, notes=notes, building=building, ) operator_item.additional_properties = d return operator_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