from ....tl.mtproto_request import MTProtoRequest


class AddStickerToSetRequest(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet"""

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

    def __init__(self, stickerset, sticker):
        """
        :param stickerset: Telegram type: "InputStickerSet".
        :param sticker: Telegram type: "InputStickerSetItem".

        :returns messages.StickerSet: Instance of StickerSet.
        """
        super().__init__()
        self.result = None
        self.confirmed = True  # Confirmed by default

        self.stickerset = stickerset
        self.sticker = sticker

    def to_dict(self):
        return {
            'stickerset': None if self.stickerset is None else self.stickerset.to_dict(),
            'sticker': None if self.sticker is None else self.sticker.to_dict(),
        }

    def on_send(self, writer):
        writer.write_int(AddStickerToSetRequest.constructor_id, signed=False)
        self.stickerset.on_send(writer)
        self.sticker.on_send(writer)

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

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet'

    def __str__(self):
        return '(stickers.addStickerToSet (ID: 0x8653febe) = (stickerset={}, sticker={}))'.format(str(self.stickerset), str(self.sticker))
