
    h,                        d dl mZ d dlZd dlZd dlmZmZ d dlmZ d dl	m
Z
 ee
j        j        e
j        j        e
j        j        f         Z G d de          ZdS )    )annotationsN)ABCabstractmethod)Union)rawc                     e Zd ZU dZdZded<   d'dZed(d	            Zed(d
            Z	ed(d            Z
ed(d            Zed)d            Zed*d            Zed+d            Zed,d            Zed-d.d            Zed-d.d            Zed-d/d            Zed-d0d"            Zed-d.d#            Zed-d.d$            Zed-d/d%            Zd1d&ZdS )2BaseStoragezThe BaseStorage class is an abstract base class defining the interface
    for different storage engines used by Hyrogram.

    Parameters:
        name (``str``):
            The name of the session.
    z
>BI?256sQ?strSESSION_STRING_FORMATnamereturnNonec                    || _         d S N)r   )selfr   s     V/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/hydrogram/storage/base.py__init__zBaseStorage.__init__+   s    			    c                
   K   dS )zOpens the storage engine.N r   s    r   openzBaseStorage.open.          	r   c                
   K   dS )z.Saves the current state of the storage engine.Nr   r   s    r   savezBaseStorage.save3   r   r   c                
   K   dS )zCloses the storage engine.Nr   r   s    r   closezBaseStorage.close8   r   r   c                
   K   dS )zDeletes the storage.Nr   r   s    r   deletezBaseStorage.delete=   r   r   peers$list[tuple[int, int, str, str, str]]c                
   K   dS )a  Update the peers table with the provided information.

        Parameters:
            peers (``List[Tuple[int, int, str, str, str]]``): A list of tuples containing the
                information of the peers to be updated. Each tuple must contain:
                - ``int``: The peer id.
                - ``int``: The peer access hash.
                - ``str``: The peer type (user, chat, or channel).
                - ``str``: The peer username (if any).
                - ``str``: The peer phone number (if any).
        Nr   )r   r    s     r   update_peerszBaseStorage.update_peersB   s       	r   peer_idint	InputPeerc                
   K   dS )zRetrieve a peer by its ID.

        Parameters:
            peer_id (``int``):
                The ID of the peer to retrieve.

        Returns:
            :obj:`~hydrogram.storage.base.InputPeer`: The retrieved peer.
        Nr   )r   r$   s     r   get_peer_by_idzBaseStorage.get_peer_by_idQ          	r   usernamec                
   K   dS )zRetrieve a peer by its username.

        Parameters:
            username (``str``):
                The username of the peer to retrieve.

        Returns:
            :obj:`~hydrogram.storage.base.InputPeer`: The retrieved peer.
        Nr   )r   r*   s     r   get_peer_by_usernamez BaseStorage.get_peer_by_username^   r)   r   phone_numberc                
   K   dS )zRetrieve a peer by its phone number.

        Parameters:
            phone_number (``str``):
                The phone number of the peer to retrieve.

        Returns:
            :obj:`~hydrogram.storage.base.InputPeer`: The retrieved peer.
        Nr   )r   r-   s     r   get_peer_by_phone_numberz$BaseStorage.get_peer_by_phone_numberk   r)   r   Nvalue
int | Nonec                
   K   dS )zGet or set the DC ID of the current session.

        Parameters:
            value (``int``, *optional*):
                The DC ID to set.

        Returns:
            ``int``: The current DC ID if no value is provided.
        Nr   r   r0   s     r   dc_idzBaseStorage.dc_idx   r)   r   c                
   K   dS )zGet or set the API ID of the current session.

        Parameters:
            value (``int``, *optional*):
                The API ID to set.

        Returns:
            ``int``: The current API ID if no value is provided.
        Nr   r3   s     r   api_idzBaseStorage.api_id   r)   r   bool | Noneboolc                
   K   dS )zGet or set the test mode of the current session.

        Parameters:
            value (``bool``, *optional*):
                The test mode to set.

        Returns:
            ``bool``: The current test mode if no value is provided.
        Nr   r3   s     r   	test_modezBaseStorage.test_mode   r)   r   bytes | Nonebytesc                
   K   dS )a  Get or set the authorization key of the current session.

        Parameters:
            value (``bytes``, *optional*):
                The authorization key to set.

        Returns:
            ``bytes``: The current authorization key if no value is provided.
        Nr   r3   s     r   auth_keyzBaseStorage.auth_key   r)   r   c                
   K   dS )zGet or set the date of the current session.

        Parameters:
            value (``int``, *optional*):
                The date to set.

        Returns:
            ``int``: The current date if no value is provided.
        Nr   r3   s     r   datezBaseStorage.date   r)   r   c                
   K   dS )zGet or set the user ID of the current session.

        Parameters:
            value (``int``, *optional*):
                The user ID to set.

        Returns:
            ``int``: The current user ID if no value is provided.
        Nr   r3   s     r   user_idzBaseStorage.user_id   r)   r   c                
   K   dS )zGet or set the bot flag of the current session.

        Parameters:
            value (``bool``, *optional*):
                The bot flag to set.

        Returns:
            ``bool``: The current bot flag if no value is provided.
        Nr   r3   s     r   is_botzBaseStorage.is_bot   r)   r   c           
       K   t          j        | j        |                                  d{V |                                  d{V |                                  d{V |                                  d{V |                                  d{V |                                  d{V           }t          j
        |                                                              d          S )zExports the session string for the current session.

        Returns:
            ``str``: The session string for the current session.
        N=)structpackr   r4   r6   r:   r>   rB   rD   base64urlsafe_b64encodedecoderstrip)r   packeds     r   export_session_stringz!BaseStorage.export_session_string   s       &**,,++--..""""""""--//!!!!!!,,..      ++--
 
 '//6688??DDDr   )r   r
   r   r   )r   r   )r    r!   r   r   )r$   r%   r   r&   )r*   r
   r   r&   )r-   r
   r   r&   r   )r0   r1   r   r%   )r0   r7   r   r8   )r0   r;   r   r<   )r   r
   )__name__
__module____qualname____doc__r   __annotations__r   r   r   r   r   r   r#   r(   r,   r/   r4   r6   r:   r>   r@   rB   rD   rN   r   r   r   r	   r	       se          ".----       ^    ^    ^    ^    ^ 
 
 
 ^
 
 
 
 ^
 
 
 
 ^
 
 
 
 
 ^
 
 
 
 
 ^
 
 
 
 
 ^
 
 
 
 
 ^
 
 
 
 
 ^
 
 
 
 
 ^
 
 
 
 
 ^
E E E E E Er   r	   )
__future__r   rI   rG   abcr   r   typingr   	hydrogramr   typesInputPeerUserInputPeerChatInputPeerChannelr&   r	   r   r   r   <module>r\      s   ( # " " " " "   # # # # # # # #            #))39+BCID^^_	BE BE BE BE BE# BE BE BE BE BEr   