from telethon.tl.mtproto_request import MTProtoRequest


class KeyboardButtonCallback(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton"""

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

    def __init__(self, text, data):
        """
        :param text: Telegram type: «string».
        :param data: Telegram type: «bytes».
        """
        super().__init__()

        self.text = text
        self.data = data

    def on_send(self, writer):
        writer.write_int(KeyboardButtonCallback.constructor_id, signed=False)
        writer.tgwrite_string(self.text)
        writer.tgwrite_bytes(self.data)

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

    def on_response(self, reader):
        self.text = reader.tgread_string()
        self.data = reader.tgread_bytes()

    def __repr__(self):
        return 'keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton'

    def __str__(self):
        return '(keyboardButtonCallback (ID: 0x683a5e46) = (text={}, data={}))'.format(str(self.text), str(self.data))
