from ...tl.tlobject import TLObject


class StickerPack(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack"""

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

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

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

        self.emoticon = emoticon
        self.documents = documents

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

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

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

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

    def __repr__(self):
        return 'stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack'

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

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