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


class BlockRequest(TLObject):
    constructor_id = 0x332b49fc
    subclass_of_id = 0xf5b399ac

    def __init__(self, id):
        """
        :param id: Telegram type: "InputUser".

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.id = get_input_user(id)

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

    def on_send(self, writer):
        writer.write_int(BlockRequest.constructor_id, signed=False)
        self.id.on_send(writer)

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

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

    def __repr__(self):
        return 'contacts.block#332b49fc id:InputUser = Bool'

    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 DeleteContactRequest(TLObject):
    constructor_id = 0x8e953744
    subclass_of_id = 0x524d5ae9

    def __init__(self, id):
        """
        :param id: Telegram type: "InputUser".

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

        self.id = get_input_user(id)

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

    def on_send(self, writer):
        writer.write_int(DeleteContactRequest.constructor_id, signed=False)
        self.id.on_send(writer)

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

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

    def __repr__(self):
        return 'contacts.deleteContact#8e953744 id:InputUser = contacts.Link'

    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 DeleteContactsRequest(TLObject):
    constructor_id = 0x59ab389e
    subclass_of_id = 0xf5b399ac

    def __init__(self, id):
        """
        :param id: Telegram type: "InputUser". Must be a list.

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.id = [get_input_user(_x) for _x in id]

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

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

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

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

    def __repr__(self):
        return 'contacts.deleteContacts#59ab389e id:Vector<InputUser> = Bool'

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

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



class ExportCardRequest(TLObject):
    constructor_id = 0x84e53737
    subclass_of_id = 0x5026710f

    def __init__(self):
        super().__init__()
        self.result = None
        self.content_related = True

    @staticmethod
    def to_dict():
        return {}

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

    @staticmethod
    def empty():
        return ExportCardRequest()

    def on_response(self, reader):
        reader.read_int()  # Vector id
        count = reader.read_int()
        self.result = [reader.read_int() for _ in range(count)]

    def __repr__(self):
        return 'contacts.exportCard#84e53737 = Vector<int>'

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

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



class GetBlockedRequest(TLObject):
    constructor_id = 0xf57c350f
    subclass_of_id = 0xffba4f4f

    def __init__(self, offset, limit):
        """
        :param offset: Telegram type: "int".
        :param limit: Telegram type: "int".

        :returns contacts.Blocked: Instance of either Blocked, BlockedSlice.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.offset = offset
        self.limit = limit

    def to_dict(self):
        return {
            'offset': self.offset,
            'limit': self.limit,
        }

    def on_send(self, writer):
        writer.write_int(GetBlockedRequest.constructor_id, signed=False)
        writer.write_int(self.offset)
        writer.write_int(self.limit)

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

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

    def __repr__(self):
        return 'contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked'

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

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



class GetContactsRequest(TLObject):
    constructor_id = 0xc023849f
    subclass_of_id = 0x38be25f6

    def __init__(self, hash):
        """
        :param hash: Telegram type: "int".

        :returns contacts.Contacts: Instance of either ContactsNotModified, Contacts.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.hash = hash

    def to_dict(self):
        return {
            'hash': self.hash,
        }

    def on_send(self, writer):
        writer.write_int(GetContactsRequest.constructor_id, signed=False)
        writer.write_int(self.hash)

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

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

    def __repr__(self):
        return 'contacts.getContacts#c023849f hash:int = contacts.Contacts'

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

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



class GetStatusesRequest(TLObject):
    constructor_id = 0xc4a353ee
    subclass_of_id = 0xdf815c90

    def __init__(self):
        super().__init__()
        self.result = None
        self.content_related = True

    @staticmethod
    def to_dict():
        return {}

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

    @staticmethod
    def empty():
        return GetStatusesRequest()

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

    def __repr__(self):
        return 'contacts.getStatuses#c4a353ee = Vector<ContactStatus>'

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

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



class GetTopPeersRequest(TLObject):
    constructor_id = 0xd4982db5
    subclass_of_id = 0x9ee8bb88

    def __init__(self, offset, limit, hash, correspondents=None, bots_pm=None, bots_inline=None, phone_calls=None, groups=None, channels=None):
        """
        :param correspondents: Telegram type: "true".
        :param bots_pm: Telegram type: "true".
        :param bots_inline: Telegram type: "true".
        :param phone_calls: Telegram type: "true".
        :param groups: Telegram type: "true".
        :param channels: Telegram type: "true".
        :param offset: Telegram type: "int".
        :param limit: Telegram type: "int".
        :param hash: Telegram type: "int".

        :returns contacts.TopPeers: Instance of either TopPeersNotModified, TopPeers.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.correspondents = correspondents
        self.bots_pm = bots_pm
        self.bots_inline = bots_inline
        self.phone_calls = phone_calls
        self.groups = groups
        self.channels = channels
        self.offset = offset
        self.limit = limit
        self.hash = hash

    def to_dict(self):
        return {
            'correspondents': self.correspondents,
            'bots_pm': self.bots_pm,
            'bots_inline': self.bots_inline,
            'phone_calls': self.phone_calls,
            'groups': self.groups,
            'channels': self.channels,
            'offset': self.offset,
            'limit': self.limit,
            'hash': self.hash,
        }

    def on_send(self, writer):
        writer.write_int(GetTopPeersRequest.constructor_id, signed=False)
        flags = 0
        flags |= (1 << 0) if self.correspondents else 0
        flags |= (1 << 1) if self.bots_pm else 0
        flags |= (1 << 2) if self.bots_inline else 0
        flags |= (1 << 3) if self.phone_calls else 0
        flags |= (1 << 10) if self.groups else 0
        flags |= (1 << 15) if self.channels else 0
        writer.write_int(flags)

        writer.write_int(self.offset)
        writer.write_int(self.limit)
        writer.write_int(self.hash)

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

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

    def __repr__(self):
        return 'contacts.getTopPeers#d4982db5 flags:# correspondents:flags.0?true bots_pm:flags.1?true bots_inline:flags.2?true phone_calls:flags.3?true groups:flags.10?true channels:flags.15?true offset:int limit:int hash:int = contacts.TopPeers'

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

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



class ImportCardRequest(TLObject):
    constructor_id = 0x4fe196fe
    subclass_of_id = 0x2da17977

    def __init__(self, export_card):
        """
        :param export_card: Telegram type: "int". Must be a list.

        :returns User: Instance of either UserEmpty, User.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.export_card = export_card

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

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

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

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

    def __repr__(self):
        return 'contacts.importCard#4fe196fe export_card:Vector<int> = User'

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

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



class ImportContactsRequest(TLObject):
    constructor_id = 0x2c800be5
    subclass_of_id = 0x8172ad93

    def __init__(self, contacts):
        """
        :param contacts: Telegram type: "InputContact". Must be a list.

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

        self.contacts = contacts

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

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

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

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

    def __repr__(self):
        return 'contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts'

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

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



class ResetSavedRequest(TLObject):
    constructor_id = 0x879537f1
    subclass_of_id = 0xf5b399ac

    def __init__(self):
        super().__init__()
        self.result = None
        self.content_related = True

    @staticmethod
    def to_dict():
        return {}

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

    @staticmethod
    def empty():
        return ResetSavedRequest()

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

    def __repr__(self):
        return 'contacts.resetSaved#879537f1 = Bool'

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

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

from ...utils import get_input_peer


class ResetTopPeerRatingRequest(TLObject):
    constructor_id = 0x1ae373ac
    subclass_of_id = 0xf5b399ac

    def __init__(self, category, peer):
        """
        :param category: Telegram type: "TopPeerCategory".
        :param peer: Telegram type: "InputPeer".

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.category = category
        self.peer = get_input_peer(peer)

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

    def on_send(self, writer):
        writer.write_int(ResetTopPeerRatingRequest.constructor_id, signed=False)
        self.category.on_send(writer)
        self.peer.on_send(writer)

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

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

    def __repr__(self):
        return 'contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = Bool'

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

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



class ResolveUsernameRequest(TLObject):
    constructor_id = 0xf93ccba3
    subclass_of_id = 0xf065b3a8

    def __init__(self, username):
        """
        :param username: Telegram type: "string".

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

        self.username = username

    def to_dict(self):
        return {
            'username': self.username,
        }

    def on_send(self, writer):
        writer.write_int(ResolveUsernameRequest.constructor_id, signed=False)
        writer.tgwrite_string(self.username)

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

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

    def __repr__(self):
        return 'contacts.resolveUsername#f93ccba3 username:string = contacts.ResolvedPeer'

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

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



class SearchRequest(TLObject):
    constructor_id = 0x11f812d8
    subclass_of_id = 0x4386a2e3

    def __init__(self, q, limit):
        """
        :param q: Telegram type: "string".
        :param limit: Telegram type: "int".

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

        self.q = q
        self.limit = limit

    def to_dict(self):
        return {
            'q': self.q,
            'limit': self.limit,
        }

    def on_send(self, writer):
        writer.write_int(SearchRequest.constructor_id, signed=False)
        writer.tgwrite_string(self.q)
        writer.write_int(self.limit)

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

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

    def __repr__(self):
        return 'contacts.search#11f812d8 q:string limit:int = contacts.Found'

    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 UnblockRequest(TLObject):
    constructor_id = 0xe54100bd
    subclass_of_id = 0xf5b399ac

    def __init__(self, id):
        """
        :param id: Telegram type: "InputUser".

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.id = get_input_user(id)

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

    def on_send(self, writer):
        writer.write_int(UnblockRequest.constructor_id, signed=False)
        self.id.on_send(writer)

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

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

    def __repr__(self):
        return 'contacts.unblock#e54100bd id:InputUser = Bool'

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

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

