"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
from ...utils import get_input_peer, get_input_channel, get_input_user, get_input_media, get_input_photo
import os
import struct


class AnswerWebhookJSONQueryRequest(TLObject):
    CONSTRUCTOR_ID = 0xe6213f4d
    SUBCLASS_OF_ID = 0xf5b399ac

    def __init__(self, query_id, data):
        """
        :param int query_id:
        :param TLObject data:

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.query_id = query_id
        self.data = data

    def to_dict(self, recursive=True):
        return {
            'query_id': self.query_id,
            'data': (None if self.data is None else self.data.to_dict()) if recursive else self.data,
        }

    def __bytes__(self):
        return b''.join((
            b'M?!\xe6',
            struct.pack('<q', self.query_id),
            bytes(self.data),
        ))

    @staticmethod
    def from_reader(reader):
        _query_id = reader.read_long()
        _data = reader.tgread_object()
        return AnswerWebhookJSONQueryRequest(query_id=_query_id, data=_data)

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

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)


class SendCustomRequestRequest(TLObject):
    CONSTRUCTOR_ID = 0xaa2769ed
    SUBCLASS_OF_ID = 0xad0352e8

    def __init__(self, custom_method, params):
        """
        :param str custom_method:
        :param TLObject params:

        :returns DataJSON: Instance of DataJSON.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.custom_method = custom_method
        self.params = params

    def to_dict(self, recursive=True):
        return {
            'custom_method': self.custom_method,
            'params': (None if self.params is None else self.params.to_dict()) if recursive else self.params,
        }

    def __bytes__(self):
        return b''.join((
            b"\xedi'\xaa",
            TLObject.serialize_bytes(self.custom_method),
            bytes(self.params),
        ))

    @staticmethod
    def from_reader(reader):
        _custom_method = reader.tgread_string()
        _params = reader.tgread_object()
        return SendCustomRequestRequest(custom_method=_custom_method, params=_params)

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

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)
