o
    Fh
                     @  s   d dl mZ d dlmZmZ d dlmZmZmZm	Z	m
Z
mZmZmZ d dlmZmZ d dlmZ d dlmZ ddlmZmZ dd	lmZ erLdd
lmZ ededZG dd deZG dd deee ZG dd deeee eZdS )    )annotations)ABCabstractmethod)TYPE_CHECKINGAnyClassVarDict	GeneratorGenericOptionalTypeVar)	BaseModel
ConfigDict)model_validator)BotContextController   )	InputFileResponseParameters)
UNSET_TYPE)BotTelegramType)boundc                   @  s0   e Zd ZU eddZded< ded< ded< d	S )
RequestT)arbitrary_types_allowedstrmethodzDict[str, Optional[Any]]datazOptional[Dict[str, InputFile]]filesN)__name__
__module____qualname__r   model_config__annotations__ r#   r#   G/var/www/html/venv/lib/python3.10/site-packages/aiogram/methods/base.pyr      s
   
 
r   c                   @  sF   e Zd ZU ded< dZded< dZded< dZded	< dZd
ed< dS )ResponseboolokNzOptional[TelegramType]resultzOptional[str]descriptionzOptional[int]
error_codezOptional[ResponseParameters]
parameters)r   r   r    r"   r(   r)   r*   r+   r#   r#   r#   r$   r%   &   s   
 r%   c                   @  s   e Zd ZU eddddZeddedd	d
Zer#de	d< de	d< ne
edddZe
ed ddZd!ddZd"ddZdS )#TelegramMethodallowT)extrapopulate_by_namer   before)modevaluesDict[str, Any]returnc                 C  s    t |ts|S dd | D S )a  
        Remove UNSET before fields validation.

        We use UNSET as a sentinel value for `parse_mode` and replace it to real value later.
        It isn't a problem when it's just default value for a model field,
        but UNSET might be passing to a model initialization from `Bot.method_name`,
        so we must take care of it and remove it before fields validation.
        c                 S  s    i | ]\}}t |ts||qS r#   )
isinstancer   ).0kvr#   r#   r$   
<dictcomp>B   s     z/TelegramMethod.remove_unset.<locals>.<dictcomp>)r5   dictitems)clsr2   r#   r#   r$   remove_unset5   s   
zTelegramMethod.remove_unsetzClassVar[Any]__returning__zClassVar[str]__api_method__typec                 C     d S Nr#   selfr#   r#   r$   r>   I      zTelegramMethod.__returning__r   c                 C  rA   rB   r#   rC   r#   r#   r$   r?   N   rE   zTelegramMethod.__api_method__botr   r   c                   s   || I d H S rB   r#   rD   rF   r#   r#   r$   emitS   s   zTelegramMethod.emit"Generator[Any, None, TelegramType]c                 C  s    | j }|s	td| | S )NzThis method is not mounted to a any bot instance, please call it explicilty with bot instance `await bot(method)`
or mount method to a bot instance `method.as_(bot)` and then call it `await method`)_botRuntimeErrorrH   	__await__rG   r#   r#   r$   rL   V   s   zTelegramMethod.__await__N)r2   r3   r4   r3   )r4   r@   )r4   r   )rF   r   r4   r   )r4   rI   )r   r   r    r   r!   r   classmethodr=   r   r"   propertyr   r>   r?   rH   rL   r#   r#   r#   r$   r,   .   s(   
 

r,   N) 
__future__r   abcr   r   typingr   r   r   r   r	   r
   r   r   pydanticr   r   pydantic.functional_validatorsr   !aiogram.client.context_controllerr   typesr   r   
types.baser   
client.botr   r   r   r%   r,   r#   r#   r#   r$   <module>   s    (	