from typing import ( TYPE_CHECKING, Any, BinaryIO, Dict, List, Optional, TextIO, Tuple, Type, TypeVar, Union, ) import attr from ..types import UNSET, Unset T = TypeVar("T", bound="FacebookTargetingGeolocation") @attr.s(auto_attribs=True) class FacebookTargetingGeolocation: """ Attributes: key (str): name (str): type (str): country_code (Union[Unset, None, str]): country_name (Union[Unset, None, str]): region (Union[Unset, None, str]): """ key: str name: str type: str country_code: Union[Unset, None, str] = UNSET country_name: Union[Unset, None, str] = UNSET region: Union[Unset, None, str] = UNSET additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: key = self.key name = self.name type = self.type country_code = self.country_code country_name = self.country_name region = self.region field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "key": key, "name": name, "type": type, } ) if country_code is not UNSET: field_dict["countryCode"] = country_code if country_name is not UNSET: field_dict["countryName"] = country_name if region is not UNSET: field_dict["region"] = region return field_dict @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() key = d.pop("key") name = d.pop("name") type = d.pop("type") country_code = d.pop("countryCode", UNSET) country_name = d.pop("countryName", UNSET) region = d.pop("region", UNSET) facebook_targeting_geolocation = cls( key=key, name=name, type=type, country_code=country_code, country_name=country_name, region=region, ) facebook_targeting_geolocation.additional_properties = d return facebook_targeting_geolocation @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