from typing import ( TYPE_CHECKING, Any, BinaryIO, Dict, List, Optional, TextIO, Tuple, Type, TypeVar, Union, ) import attr from ..models.campaign_objective import CampaignObjective from ..types import UNSET, Unset T = TypeVar("T", bound="MetaCampaignInput") @attr.s(auto_attribs=True) class MetaCampaignInput: """ Attributes: name (str): vendor_id (int): global_participant_id (str): facebook_page_id (str): objective (CampaignObjective): An enumeration. subaccount_id (Union[Unset, None, int]): product_id (Union[Unset, None, int]): """ name: str vendor_id: int global_participant_id: str facebook_page_id: str objective: CampaignObjective subaccount_id: Union[Unset, None, int] = UNSET product_id: Union[Unset, None, int] = UNSET additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: name = self.name vendor_id = self.vendor_id global_participant_id = self.global_participant_id facebook_page_id = self.facebook_page_id objective = self.objective.value subaccount_id = self.subaccount_id product_id = self.product_id field_dict: Dict[str, Any] = {} field_dict.update(self.additional_properties) field_dict.update( { "name": name, "vendorId": vendor_id, "globalParticipantId": global_participant_id, "facebookPageId": facebook_page_id, "objective": objective, } ) if subaccount_id is not UNSET: field_dict["subaccountId"] = subaccount_id if product_id is not UNSET: field_dict["productId"] = product_id return field_dict @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() name = d.pop("name") vendor_id = d.pop("vendorId") global_participant_id = d.pop("globalParticipantId") facebook_page_id = d.pop("facebookPageId") objective = CampaignObjective(d.pop("objective")) subaccount_id = d.pop("subaccountId", UNSET) product_id = d.pop("productId", UNSET) meta_campaign_input = cls( name=name, vendor_id=vendor_id, global_participant_id=global_participant_id, facebook_page_id=facebook_page_id, objective=objective, subaccount_id=subaccount_id, product_id=product_id, ) meta_campaign_input.additional_properties = d return meta_campaign_input @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