from ...tl.mtproto_request import MTProtoRequest


class StickerSetMultiCovered(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered"""

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

    def __init__(self, set, covers):
        """
        :param set: Telegram type: «StickerSet».
        :param covers: Telegram type: «Document». Must be a list.

        Constructor for StickerSetCovered: Instance of either StickerSetCovered, StickerSetMultiCovered.
        """
        super().__init__()

        self.set = set
        self.covers = covers

    def on_send(self, writer):
        writer.write_int(StickerSetMultiCovered.constructor_id, signed=False)
        self.set.on_send(writer)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.covers))
        for covers_item in self.covers:
            covers_item.on_send(writer)

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

    def on_response(self, reader):
        self.set = reader.tgread_object()
        reader.read_int()  # Vector's constructor ID
        self.covers = []  # Initialize an empty list
        covers_len = reader.read_int()
        for _ in range(covers_len):
            covers_item = reader.tgread_object()
            self.covers.append(covers_item)

    def __repr__(self):
        return 'stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered'

    def __str__(self):
        return '(stickerSetMultiCovered (ID: 0x3407e51b) = (set={}, covers={}))'.format(str(self.set), None if not self.covers else [str(_) for _ in self.covers])
