U
    g                     @   sH   d Z ddlmZ ddlmZ ddlmZ ddlmZ G dd deZ	dS )	zCThis module contains an object that represents a Telegram Birthday.    )date)Optional)TelegramObject)JSONDictc                       sV   e Zd ZdZdZdddeeee ee d fddZdee e	dd	d
Z
  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_kwargs)r   r   r	   r   c                   s:   t  j|d || _|| _|| _| j| jf| _|   d S )Nr
   )super__init__r   r   r	   Z	_id_attrsZ_freeze)selfr   r   r	   r   	__class__ 7/tmp/pip-unpacked-wheel-swnnwir2/telegram/_birthdate.pyr   2   s    zBirthdate.__init__)r	   returnc                 C   s0   | j dkr|dkrtdt|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	   
ValueErrorr   r   r   )r   r	   r   r   r   to_dateI   s
    zBirthdate.to_date)N)N)__name__
__module____qualname____doc__	__slots__intr   r   r   r   r   __classcell__r   r   r   r   r      s    r   N)
r   datetimer   typingr   Ztelegram._telegramobjectr   Ztelegram._utils.typesr   r   r   r   r   r   <module>   s
   