from ....tl.tlobject import TLObject


class StickerSet(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet"""

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

    def __init__(self, set, packs, documents):
        """
        :param set: Telegram type: "StickerSet".
        :param packs: Telegram type: "StickerPack". Must be a list.
        :param documents: Telegram type: "Document". Must be a list.

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

        self.set = set
        self.packs = packs
        self.documents = documents

    def to_dict(self):
        return {
            'set': None if self.set is None else self.set.to_dict(),
            'packs': [] if self.packs is None else [None if x is None else x.to_dict() for x in self.packs],
            'documents': [] if self.documents is None else [None if x is None else x.to_dict() for x in self.documents],
        }

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

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

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

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

        reader.read_int()  # Vector's constructor ID
        self.documents = []  # Initialize an empty list
        _len = reader.read_int()
        for _ in range(_len):
            _x = reader.tgread_object()
            self.documents.append(_x)

    def __repr__(self):
        return 'messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet'

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

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