"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
from ...utils import get_input_peer, get_input_channel, get_input_user, get_input_media
import os
import struct


class AddStickerToSetRequest(TLObject):
    CONSTRUCTOR_ID = 0x8653febe
    SUBCLASS_OF_ID = 0x9b704a5a

    def __init__(self, stickerset, sticker):
        """
        :param TLObject stickerset:
        :param TLObject sticker:

        :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, recursive=True):
        return {
            'stickerset': (None if self.stickerset is None else self.stickerset.to_dict()) if recursive else self.stickerset,
            'sticker': (None if self.sticker is None else self.sticker.to_dict()) if recursive else self.sticker,
        }

    def to_bytes(self):
        return b''.join((
            b'\xbe\xfeS\x86',
            self.stickerset.to_bytes(),
            self.sticker.to_bytes(),
        ))

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

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

    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 TLObject sticker:
        :param int position:

        :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, recursive=True):
        return {
            'sticker': (None if self.sticker is None else self.sticker.to_dict()) if recursive else self.sticker,
            'position': self.position,
        }

    def to_bytes(self):
        return b''.join((
            b'\xca\xd4\xb6\xff',
            self.sticker.to_bytes(),
            struct.pack('<i', self.position),
        ))

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

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

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

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


class CreateStickerSetRequest(TLObject):
    CONSTRUCTOR_ID = 0x9bd86e6a
    SUBCLASS_OF_ID = 0x9b704a5a

    def __init__(self, user_id, title, short_name, stickers, masks=None):
        """
        :param bool | None masks:
        :param TLObject user_id:
        :param str title:
        :param str short_name:
        :param list[TLObject] stickers:

        :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, recursive=True):
        return {
            'masks': self.masks,
            'user_id': (None if self.user_id is None else self.user_id.to_dict()) if recursive else self.user_id,
            '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]) if recursive else self.stickers,
        }

    def to_bytes(self):
        return b''.join((
            b'jn\xd8\x9b',
            struct.pack('<I', (1 if self.masks else 0)),
            self.user_id.to_bytes(),
            TLObject.serialize_bytes(self.title),
            TLObject.serialize_bytes(self.short_name),
            b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.stickers)),b''.join(x.to_bytes() for x in self.stickers),
        ))

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

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

    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 TLObject sticker:

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

        self.sticker = sticker

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

    def to_bytes(self):
        return b''.join((
            b'Q\x0fv\xf7',
            self.sticker.to_bytes(),
        ))

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

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

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

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