"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject


class AddStickerToSetRequest(TLObject):
    constructor_id = 0x8653febe
    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.content_related = True

        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():
        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 TLObject.pretty_format(self)

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



class ChangeStickerPositionRequest(TLObject):
    constructor_id = 0xffb6d4ca
    subclass_of_id = 0x9b704a5a

    def __init__(self, sticker, position):
        """
        :param sticker: Telegram type: "InputDocument".
        :param position: Telegram type: "int".

        :returns messages.StickerSet: Instance of StickerSet.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.sticker = sticker
        self.position = position

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

    def on_send(self, writer):
        writer.write_int(ChangeStickerPositionRequest.constructor_id, signed=False)
        self.sticker.on_send(writer)
        writer.write_int(self.position)

    @staticmethod
    def empty():
        return ChangeStickerPositionRequest(None, None)

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

    def __repr__(self):
        return 'stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet'

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

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

from ...utils import get_input_user


class CreateStickerSetRequest(TLObject):
    constructor_id = 0x9bd86e6a
    subclass_of_id = 0x9b704a5a

    def __init__(self, user_id, title, short_name, stickers, masks=None):
        """
        :param masks: Telegram type: "true".
        :param user_id: Telegram type: "InputUser".
        :param title: Telegram type: "string".
        :param short_name: Telegram type: "string".
        :param stickers: Telegram type: "InputStickerSetItem". Must be a list.

        :returns messages.StickerSet: Instance of StickerSet.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.masks = masks
        self.user_id = get_input_user(user_id)
        self.title = title
        self.short_name = short_name
        self.stickers = stickers

    def to_dict(self):
        return {
            'masks': self.masks,
            'user_id': None if self.user_id is None else self.user_id.to_dict(),
            'title': self.title,
            'short_name': self.short_name,
            'stickers': [] if self.stickers is None else [None if x is None else x.to_dict() for x in self.stickers],
        }

    def on_send(self, writer):
        writer.write_int(CreateStickerSetRequest.constructor_id, signed=False)
        flags = 0
        flags |= (1 << 0) if self.masks else 0
        writer.write_int(flags)

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

    @staticmethod
    def empty():
        return CreateStickerSetRequest(None, None, None, None, None)

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

    def __repr__(self):
        return 'stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector<InputStickerSetItem> = messages.StickerSet'

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

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



class RemoveStickerFromSetRequest(TLObject):
    constructor_id = 0xf7760f51
    subclass_of_id = 0x9b704a5a

    def __init__(self, sticker):
        """
        :param sticker: Telegram type: "InputDocument".

        :returns messages.StickerSet: Instance of StickerSet.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.sticker = sticker

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

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

    @staticmethod
    def empty():
        return RemoveStickerFromSetRequest(None)

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

    def __repr__(self):
        return 'stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet'

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

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

