from ...tl.tlobject import TLObject


class InvokeAfterMsgRequest(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X"""

    # Telegram's constructor (U)ID for this class
    constructor_id = 0xcb9f372d
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0xb7b2364b

    def __init__(self, msg_id, query):
        """
        :param msg_id: Telegram type: "long".
        :param query: Telegram type: "X". Must be another TLObject request.

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

        self.msg_id = msg_id
        self.query = query

    def to_dict(self):
        return {
            'msg_id': self.msg_id,
            'query': None if self.query is None else self.query.to_dict(),
        }

    def on_send(self, writer):
        writer.write_int(InvokeAfterMsgRequest.constructor_id, signed=False)
        writer.write_long(self.msg_id)
        self.query.on_send(writer)

    @staticmethod
    def empty():
        """Returns an "empty" instance (attributes=None)"""
        return InvokeAfterMsgRequest(None, None)

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

    def __repr__(self):
        return 'invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X'

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

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