
    %
i                        U d dl mZ d dlZd dlmZ ddlmZmZ i Zde	d<   d Z
i Zde	d	<   d
 Zi Zde	d<   ddZd ZddZeej        eej        eej        eej         ed          ej        eej        iZd Zd ZdS )    )annotationsN)TimeType   )mapimapitagszdict[int, str]prTablec                    t           st          j                                        D ]\  }}|d d         dk    rt          j        |          t          j        k    s"t          j        |          t          j        k    rD|dd          dk    s|dd          dk    r|t           |<   ~|t           t          j        |          <   |t           |<   |t           t          j        |          <   	 	 t           |          S # t          $ r" t           t          j        |                    cY S w xY w# t          $ rM t          t          |                     }|d         dk    r
|dd          }|d	         d
k    r
|d d	         }|cY S w xY w)N   PR__A_Wr   -r   L)r   r   __dict__items	PROP_TYPE
PT_UNICODE
PT_STRING8PROP_IDKeyErrorhexint)ptnamevaluerets       C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\win32comext/mapi/mapiutil.pyGetPropTagNamer       s    <#,2244 	< 	<KD%BQBx5  " &u--1DDD)%00H4GGGBCCyD((DI,=,=)-;? 0 7 788 &*GEN7;GH,U334	12; 	1 	1 	18+B//0000	1  	 	 	 #b''llq6S==abb'Cr7c>>crc(C


	s+   *C7 7)D# D& "D##D& &AE=<E=mapiErrorTablec                    t           s:t          j                                        D ]\  }}|d d         dv r
|t           |<   t                               | t          j        |                     S )N   )MAPI_E_MAPI_W_)r!   r   r   r   get	pythoncomGetScodeString)hrr   r   s      r   r(   r(   A   sk     -=..00 	- 	-KD%BQBx111(,u%b)":2">">???    ptTableTc                    t           sAt          j                                        D ]"\  }}|dd         dk    r|dv r|t           |<   #|r| t          j         z  } t                               | t          t          |                               S )z?Given a mapi type flag, return a string description of the typeNr
   PT_)
PT_TSTRINGPT_MV_TSTRING)r+   r   r   r   MV_FLAGr&   strr   )propTyperawTyper   r   s       r   GetMapiTypeNamer4   L   s     &#,2244 	& 	&KD%BQBx5   :::!% &X%%%;;xS]]!3!3444r*   c                   d}t          |t          t          f          sd}|f}g }g }|D ]}t          |t                    s\t          j        |ff}|                     |d          }t          j        t          j	        t          j
        |d                             }|                    |           |                     |d          \  }}	|dk    rd}	dS |rd |	D             S |	d         d         S )as  Given a MAPI object and a list of properties, return a list of property values.

    Allows a single property to be passed, and the result is a single object.

    Each request property can be an integer or a string.  Of a string, it is
    automatically converted to an integer via the GetIdsFromNames function.

    If the property fetch fails, the result is None.
    r   r   Nc                    g | ]
}|d          S )r    ).0vs     r   
<listcomp>z!GetProperties.<locals>.<listcomp>{   s    ###!###r*   )
isinstancetuplelistr   r   PS_PUBLIC_STRINGSGetIDsFromNamesr   PROP_TAGPT_UNSPECIFIEDr   appendGetProps)
objpropListbRetListrealPropListrcproppropspropIdsr)   datas
             r   GetPropertiesrM   ]   s    Hh.. ;L	B " "$$$ 	,d35E))%33G$')9'!*)E)E D 	D!!!!||L!,,HB	Qwwt ##d####Awqzr*   c                ^   |                      d          }|                     |          \  }}g }|D ]z\  }}|rZ|                     |f          \  }}}t          |d         d         t                    r|d         d         }	nt          |          }	n|}	|                    |	|f           {|S )Nr   r   )GetPropListrC   GetNamesFromIDsr;   r1   r    rB   )
rD   make_tag_namestagsr)   rL   r   tagvalarrayr   s
             r   GetAllPropertiesrV      s    ??1D||D!!HB
C 	  	 S 	!113&99OBe%(1+s++ +Qx{%c**D

D#;Jr*   c                   t          |t                    st          j        |ff}|                     |t          j                  }|dk    s|dk    rt          j        }nLt          	                    t          |                    }|#t          d|dt          |           d          t          j        |t          j        |d                             }||                     |f           d S |                     ||ff           d S )NTFzDon't know what to do with 'z' ('z')r   )r;   r   r   r>   r?   MAPI_CREATEr   
PT_BOOLEAN_MapiTypeMapr&   type
ValueErrorr@   r   DeletePropsSetProps)rD   rI   rT   rJ   rK   type_tags         r   SetPropertyValuer`      s   dC   I($/1%%eT-=>>$;;#,,*HH#''S		22H K3KKd3iiKKK    8+;GAJ+G+GHH
{     tSk^$$$$$r*   c           	     "   g }|                                 D ];\  }}t          |t                    r!|                    t          j        |f           <|r |                     |t          j                  }d}g }|                                 D ]\  }}t          |t                    rt          |t                    rt          j	        }ngt          |t                    rt          j        }nEt          |t                    rt          j        }n#t          d|dt          |           d          t          j        |t          j        ||                             }|dz  }|                    ||f           |                     |           dS )a_  Given a Python dictionary, set the objects properties.

    If the dictionary key is a string, then a property ID is queried
    otherwise the ID is assumed native.

    Coded for maximum efficiency wrt server calls - ie, maximum of
    2 calls made to the object, regardless of the dictionary contents
    (only 1 if dictionary full of int keys)
    r   zThe type of object (z) can not be writtenr   N)r   r;   r1   rB   r   r>   r?   rX   r   r   r   PT_I4r   
PT_SYSTIMEr\   r[   r@   r   r^   )msgpropDictnewPropskeyrT   newIdsnewIdNotagTypes           r   SetPropertiesrl      s    HNN$$ ; ;Sc3 	;OOT3S9::: A$$Xt/?@@GHNN$$ $ $Sc3 	#s## 	"-C%% ".C** "- Q#QQ$s))QQQ   #GX-=fWo-N-NOOCqLGc
####LLr*   )T) 
__future__r   r'   
pywintypesr    r   r   r   __annotations__r    r!   r(   r+   r4   rM   rV   float	PT_DOUBLEr   rc   bytesr   r1   r   r[   rA   boolrY   rZ   r`   rl   r7   r*   r   <module>ru      sI   " " " " " " "                      / / /d "$ # # # #@ @ @     5 5 5 5"     F   $ 
8	8	DJJ'(
% % %($ $ $ $ $r*   