ó
    �®žjr
  ã                  ó`   • S r SSKJr  SSKrSSKJr  SSKJr	  SSK
Jr  SSKJr   " S S	5      rg)
aÐ  Provides access to the properties of an attachment in an Outlook MSG file.

These properies include the attached file's original file-name, its last-modified date, size, and
content-type (MIME-type).

```python
>>> from oxmsg import Message

>>> msg = Message.load("message.msg")
>>> msg.attachment_count
1
>>> attachment = msg.attachments[0]
>>> attachment.file_name
'financial-forecast.xlsx'
>>> with open(attachment.file_name, "wb") as f:
...     f.write()
```
é    )ÚannotationsN)Ú	constants)Úmodel)Ú
Properties)Úlazypropertyc                  ó®   • \ rS rSrSrSS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS j5       r\SS	 j5       r\SS
 j5       rSrg)Ú
Attachmenté   z,A file attached to an Outlook email message.c                ó   • Xl         g )N©Ú_storage)ÚselfÚstorages     ÚM/home/mande/repo/quber/.venv/lib/python3.13/site-packages/oxmsg/attachment.pyÚ__init__ÚAttachment.__init__!   s   € Ø�ó    c                ó–   • U R                   R                  [        R                  5      nUc   e[	        U[
        R                  -  5      $ )z˜True when the `PidTagAttachDataBinary` property contains the attachment data.

This is as opposed to "by-reference" where only a path or URL is stored.
)Ú
propertiesÚint_prop_valueÚcÚPID_ATTACH_METHODÚboolÚmÚAF_BY_VALUE)r   Úattach_methods     r   Úattached_by_valueÚAttachment.attached_by_value$   s>   € ð Ÿ™×6Ñ6´q×7JÑ7JÓKˆØÑ(Ð(Ð(Ü�M¤A§M¡MÑ1Ó2Ð2r   c                óT   • U R                   R                  [        R                  5      $ )zDThe attachment binary, suitable for saving to a file when detaching.)r   Úbinary_prop_valuer   ÚPID_ATTACH_DATA_BINARY©r   s    r   Ú
file_bytesÚAttachment.file_bytes.   s   € ð �‰×0Ñ0´×1IÑ1IÓJÐJr   c                óT   • U R                   R                  [        R                  5      $ )z|The full name of this file as it was originally attached.

Like "FY24-quarterly-projections.xlsx". Does not include a path.
)r   Ústr_prop_valuer   ÚPID_ATTACH_LONG_FILENAMEr"   s    r   Ú	file_nameÚAttachment.file_name3   s   € ð �‰×-Ñ-¬a×.HÑ.HÓIÐIr   c                óT   • U R                   R                  [        R                  5      $ )zTimezone-aware UTC datetime when this attachment was last modified.

`None` if this property is not present on the attachment.
)r   Údate_prop_valuer   ÚPID_LAST_MODIFICATION_TIMEr"   s    r   Úlast_modifiedÚAttachment.last_modified;   s   € ð �‰×.Ñ.¬q×/KÑ/KÓLÐLr   c                óf   • U R                   R                  [        R                  5      =(       d    S$ )zFISO 8601 str representation of time this attachment was last modified.zapplication/octet-stream)r   r&   r   ÚPID_ATTACH_MIME_TAGr"   s    r   Ú	mime_typeÚAttachment.mime_typeC   s%   € ð �‰×-Ñ-¬a×.CÑ.CÓD×bÐHbÐbr   c                óF   • [        U R                  [        R                  S9$ )z7Provides access to the properties of this OXMSG object.)Úproperties_header_offset)r   r   r   ÚATTACH_HDR_OFFSETr"   s    r   r   ÚAttachment.propertiesH   s   € ô ˜$Ÿ-™-Ä!×BUÑBUÑVÐVr   c                óR   • U R                   (       a  [        U R                   5      $ S$ )z#Length in bytes of this attachment.r   )r#   Úlenr"   s    r   ÚsizeÚAttachment.sizeM   s   € ð (,§§Œs�4—?‘?Ó#Ð=¸AÐ=r   r   N)r   z
m.StorageT)Úreturnr   )r;   zbytes | None)r;   z
str | None)r;   zdt.datetime | None)r;   r   )r;   Úint)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r#   r(   r-   r1   r   r9   Ú__static_attributes__© r   r   r	   r	      s    † Ù6ô ð ó3ó ð3ð óKó ðKð óJó ðJð óMó ðMð ócó ðcð óWó ðWð ó>ó ó>r   r	   )rA   Ú
__future__r   ÚdatetimeÚdtÚoxmsg.domainr   r   r   r   Úoxmsg.propertiesr   Ú
oxmsg.utilr   r	   rC   r   r   Ú<module>rJ      s(   ðñõ& #ã å 'Ý #Ý 'Ý #÷2>ò 2>r   