from ...tl.mtproto_request import MTProtoRequest


class UserStatusOnline(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    userStatusOnline#edb93949 expires:date = UserStatus"""

    # Telegram's constructor ID (and unique identifier) for this class
    constructor_id = 0xedb93949

    def __init__(self, expires):
        """
        :param expires: Telegram type: «date».

        Constructor for UserStatus: Instance of either UserStatusEmpty, UserStatusOnline, UserStatusOffline, UserStatusRecently, UserStatusLastWeek, UserStatusLastMonth.
        """
        super().__init__()

        self.expires = expires

    def on_send(self, writer):
        writer.write_int(UserStatusOnline.constructor_id, signed=False)
        writer.tgwrite_date(self.expires)

    @staticmethod
    def empty():
        """Returns an "empty" instance (all attributes are None)"""
        return UserStatusOnline(None)

    def on_response(self, reader):
        self.expires = reader.tgread_date()

    def __repr__(self):
        return 'userStatusOnline#edb93949 expires:date = UserStatus'

    def __str__(self):
        return '(userStatusOnline (ID: 0xedb93949) = (expires={}))'.format(str(self.expires))
