from ...tl.tlobject import TLObject


class MsgsAllInfo(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    msgs_all_info#8cc0d131 msg_ids:Vector<long> info:string = MsgsAllInfo"""

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

    def __init__(self, msg_ids, info):
        """
        :param msg_ids: Telegram type: "long". Must be a list.
        :param info: Telegram type: "string".

        Constructor for MsgsAllInfo: Instance of MsgsAllInfo.
        """
        super().__init__()

        self.msg_ids = msg_ids
        self.info = info

    def to_dict(self):
        return {
            'msg_ids': [] if self.msg_ids is None else self.msg_ids[:],
            'info': self.info,
        }

    def on_send(self, writer):
        writer.write_int(MsgsAllInfo.constructor_id, signed=False)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.msg_ids))
        for _x in self.msg_ids:
            writer.write_long(_x)

        writer.tgwrite_string(self.info)

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

    def on_response(self, reader):
        reader.read_int()  # Vector's constructor ID
        self.msg_ids = []  # Initialize an empty list
        _len = reader.read_int()
        for _ in range(_len):
            _x = reader.read_long()
            self.msg_ids.append(_x)

        self.info = reader.tgread_string()

    def __repr__(self):
        return 'msgs_all_info#8cc0d131 msg_ids:Vector<long> info:string = MsgsAllInfo'

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

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