+
    TŎi
                     J    ^ RI Ht ^ RIHt ^ RIHt ^ RIHt  ! R R4      tR# )    )	AdAccount)FacebookAdsApi)FacebookBadObjectError)AbstractCrudObjectc                   Z   a  ] tR t^t o ]R	R l4       tR tR tR
R ltR t	R
R lt
RtV tR# )AdImageMixinNc                @   T;'       g    \         P                  ! 4       p\        VR 4      ;_uu_ 4       pVP                  RW P	                  4       3W/R7      pRRR4       XP                  4       p. pVR,           F  pV ! VR7      p	V	P                  VR,          V,          4       VR,          : RVR,          V,          V P                  P                  ,          : 2WP                  P                  &   VP                  V	4       K  	  V#   + '       g   i     L; i)rbPOST)filesNimages)	parent_id   NN:)r   get_default_apiopencallget_endpointjsonupdateFieldhashidappend)
clsfilenamer   api	open_fileresponsedataobjsimage_filenameimages
   &&&&      /Users/ahmad/.openclaw/workspace/scripts/.venv/lib/python3.14/site-packages/facebook_business/adobjects/helpers/adimagemixin.pyremote_create_from_zip#AdImageMixin.remote_create_from_zip   s    55^335(D!!Yxx,,./+   H " }}"8nnN),ELLh78"X~.syy~~>#E)),, KK - % "!s   %DD	c                B    V P                  4       V P                  4       3# N)get_parent_id_assuredr   selfs   &r%   get_node_pathAdImageMixin.get_node_path$   s    **,d.?.?.ABB    c                   RV9  d   \         P                  ! W4      # VR,          P                  4       w  r!\        \        V4       F4  pW,          V P
                  V&   V P                  P                  VR4       K6  	  V P                  4       R,          : RW P                  P                  ,          : 2V P
                  V P                  P                  &   V # )a  
`data` may have a different structure depending if you're creating
new AdImages or iterating over existing ones using something like
AdAccount.get_ad_images().
While reading existing images, _set_data from AbstractCrudObject
handles everything correctly, but we need to treat the
remote_create case.
remote_create sample response:
{
  "images": {
    "8cf726a44ab7008c5cc6b4ebd2491234": {
      "hash":"8cf726a44ab7008c5cc6b4ebd2491234",
      "url":"https://fbcdn-photos-a.akamaihd.net/..."
    }
  }
}
Sample response when calling act_<ACT_ID>/adimages, used internally
by AdAccount.get_ad_images():
{
  "data": [
    {
      "hash": "181b88e3cdf6464af7ed52fe488fe559",
      "id": "1739564149602806:181b88e3cdf6464af7ed52fe488fe559"
    }
  ],
  "paging": {
    "cursors": {
      "before": "MTczOTU2NDE0OTYwMjgwNjoxODFiODh==",
      "after": "MTczOTU2NDE0OTYwMjgwNjoxODFiODhl=="
    }
  }
}
r   Nr   r   )r   	_set_datapopitemmapstr_data_changespopr*   r   r   r   )r,   r!   _keys   &&  r%   r1   AdImageMixin._set_data'   s    F 4%//;;x.((*sD>C"iDJJsO MMc4(	 " &&(,,!%


4::==!
 r/   c                6   W P                   P                  ,          '       g   \        R4      hW P                   P                  ,          p\        VR4      ;_uu_ 4       p\        P
                  ! V Wx/VVVVVR7      p	RRR4       V	#   + '       g   i     X	# ; i)zUploads filename and creates the AdImage object from it.
It has same arguments as AbstractCrudObject.remote_create except it
does not have the files argument but requires the 'filename' property
to be defined.
z*AdImage required a filename to be defined.r
   )r   batchfailureparamssuccessapi_versionN)r   r   r   r   r   remote_create)
r,   r<   r=   r   r>   r?   r@   r   r   
return_vals
   &&&&&&&   r%   rA   AdImageMixin.remote_create\   s     JJ''(((<  

++,(D!!Y+99+'J "  "! s   BB	c                :    W P                   P                  ,          # )z7Returns the image hash to which AdCreative's can refer.)r   r   r+   s   &r%   get_hashAdImageMixin.get_hash{   s    JJOO$$r/   c                   W P                   P                  P                  ,          '       d   W P                   P                  P                  ,          P                  R 4      w  rx\	        V P                  4       R7      p	RV./pV	P                  W4R7      p
V
'       d%   V P                  V
^ ,          P                  4       R# R# R# )r   )fbidhashes)fieldsr>   N)		__class__r   r   splitr   r*   get_ad_imagesr1   r5   )r,   r<   r=   rJ   r>   r?   r@   r8   
image_hashaccountr   s   &&&&&&&    r%   remote_readAdImageMixin.remote_read   s     $$''(( !5!5!8!89??DMAT%?%?%ABGF
 **&*HFvay/  )r/    r)   )NNNNNN)__name__
__module____qualname____firstlineno__classmethodr&   r-   r1   rA   rE   rP   __static_attributes____classdictcell__)__classdict__s   @r%   r   r      s7      ,C3j>%0 0r/   r   N)	%facebook_business.adobjects.adaccountr   facebook_business.apir   facebook_business.exceptionsr   .facebook_business.adobjects.abstractcrudobjectr   r   rR   r/   r%   <module>r_      s    < 0 ? MF0 F0r/   