from ...tl.mtproto_request import MTProtoRequest


class MessageEntityUnknown(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity"""

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

    def __init__(self, offset, length):
        """
        :param offset: Telegram type: «int».
        :param length: Telegram type: «int».

        Constructor for MessageEntity: Instance of either MessageEntityUnknown, MessageEntityMention, MessageEntityHashtag, MessageEntityBotCommand, MessageEntityUrl, MessageEntityEmail, MessageEntityBold, MessageEntityItalic, MessageEntityCode, MessageEntityPre, MessageEntityTextUrl, MessageEntityMentionName, InputMessageEntityMentionName.
        """
        super().__init__()

        self.offset = offset
        self.length = length

    def on_send(self, writer):
        writer.write_int(MessageEntityUnknown.constructor_id, signed=False)
        writer.write_int(self.offset)
        writer.write_int(self.length)

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

    def on_response(self, reader):
        self.offset = reader.read_int()
        self.length = reader.read_int()

    def __repr__(self):
        return 'messageEntityUnknown#bb92ba95 offset:int length:int = MessageEntity'

    def __str__(self):
        return '(messageEntityUnknown (ID: 0xbb92ba95) = (offset={}, length={}))'.format(str(self.offset), str(self.length))
