from ....tl.mtproto_request import MTProtoRequest


class ArchivedStickers(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    messages.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers"""

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

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

        Constructor for messages.ArchivedStickers: Instance of ArchivedStickers.
        """
        super().__init__()

        self.count = count
        self.sets = sets

    def on_send(self, writer):
        writer.write_int(ArchivedStickers.constructor_id, signed=False)
        writer.write_int(self.count)
        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 ArchivedStickers(None, None)

    def on_response(self, reader):
        self.count = reader.read_int()
        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.archivedStickers#4fcba9c8 count:int sets:Vector<StickerSetCovered> = messages.ArchivedStickers'

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