
    i                     F    d Z ddlZddlmZ ddlmZ  G d de          ZdS )zCThis module contains an object that represents a Telegram Birthday.    N)TelegramObject)JSONDictc                   p     e Zd ZdZdZ	 ddddedededz  dedz  f fd	Zddedz  d
ej	        fdZ
 xZS )	Birthdatea  
    This object describes the birthdate of a user.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`day`, and :attr:`month` are equal.

    .. versionadded:: 21.1

    Args:
        day (:obj:`int`): Day of the user's birth; 1-31.
        month (:obj:`int`): Month of the user's birth; 1-12.
        year (:obj:`int`, optional): Year of the user's birth.

    Attributes:
        day (:obj:`int`): Day of the user's birth; 1-31.
        month (:obj:`int`): Month of the user's birth; 1-12.
        year (:obj:`int`): Optional. Year of the user's birth.

    )daymonthyearN
api_kwargsr   r   r	   r   c                    t                                          |           || _        || _        || _        | j        | j        f| _        |                                  d S )Nr
   )super__init__r   r   r	   	_id_attrs_freeze)selfr   r   r	   r   	__class__s        S/Users/shanyulin/my-agent/.venv/lib/python3.11/site-packages/telegram/_birthdate.pyr   zBirthdate.__init__2   s_     	J/// 
 $	 HJ

 	    returnc                     | j         |t          d          t          j        |p| j         | j        | j                  S )a  Return the birthdate as a date object.

        .. versionchanged:: 21.2
           Now returns a :obj:`datetime.date` object instead of a :obj:`datetime.datetime` object,
           as was originally intended.

        Args:
            year (:obj:`int`, optional): The year to use. Required, if the :attr:`year` was not
                present.

        Returns:
            :obj:`datetime.date`: The birthdate as a date object.
        NzHThe `year` argument is required if the `year` attribute was not present.)r	   
ValueErrordtmdater   r   )r   r	   s     r   to_datezBirthdate.to_dateI   sF     9Z   x)	4:tx@@@r   )N)__name__
__module____qualname____doc__	__slots__intr   r   r   r   r   __classcell__)r   s   @r   r   r      s         ( )I  	 '+    Dj	 tO     .A AC$J A#( A A A A A A A Ar   r   )r   datetimer   telegram._telegramobjectr   telegram._utils.typesr   r    r   r   <module>r&      s   & J I     3 3 3 3 3 3 * * * * * *AA AA AA AA AA AA AA AA AA AAr   