from ....tl.mtproto_request import MTProtoRequest


class AnswerWebhookJSONQueryRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool"""

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

    def __init__(self, query_id, data):
        """
        :param query_id: Telegram type: «long».
        :param data: Telegram type: «DataJSON».

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.query_id = query_id
        self.data = data

    def on_send(self, writer):
        writer.write_int(AnswerWebhookJSONQueryRequest.constructor_id, signed=False)
        writer.write_long(self.query_id)
        self.data.on_send(writer)

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

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool'

    def __str__(self):
        return '(bots.answerWebhookJSONQuery (ID: 0xe6213f4d) = (query_id={}, data={}))'.format(str(self.query_id), str(self.data))
