from ....tl.mtproto_request import MTProtoRequest


class StickerSetInstallResultArchive(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult"""

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

    def __init__(self, sets):
        """
        :param sets: Telegram type: «StickerSetCovered». Must be a list.

        Constructor for messages.StickerSetInstallResult: Instance of either StickerSetInstallResultSuccess, StickerSetInstallResultArchive.
        """
        super().__init__()

        self.sets = sets

    def on_send(self, writer):
        writer.write_int(StickerSetInstallResultArchive.constructor_id, signed=False)
        writer.write_int(0x1cb5c415, signed=False)  # Vector's constructor ID
        writer.write_int(len(self.sets))
        for sets_item in self.sets:
            sets_item.on_send(writer)

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

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

    def __repr__(self):
        return 'messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult'

    def __str__(self):
        return '(messages.stickerSetInstallResultArchive (ID: 0x35e410a8) = (sets={}))'.format(None if not self.sets else [str(_) for _ in self.sets])
