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


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

    def __init__(self, id):
        """
        :param TLObject id:

        :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 __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 TLObject id:

        :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 __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 list[TLObject] id:

        :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)
        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 __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 __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 int offset:
        :param int limit:

        :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 __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 int hash:

        :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 __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 __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 bool | None correspondents:
        :param bool | None bots_pm:
        :param bool | None bots_inline:
        :param bool | None phone_calls:
        :param bool | None groups:
        :param bool | None channels:
        :param int offset:
        :param int limit:
        :param int hash:

        :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 __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 list[int] export_card:

        :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)
        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 __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 list[TLObject] contacts:

        :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)
        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 __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 __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 TLObject category:
        :param TLObject peer:

        :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 __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 str username:

        :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 __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 str q:
        :param int limit:

        :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 __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 TLObject id:

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

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