"""File generated by TLObjects' generator. All changes will be ERASED"""
from ..._misc.tlobject import TLObject, TLRequest
from typing import Optional, List, Union, TYPE_CHECKING
import os
import struct
import dataclasses
from datetime import datetime
if TYPE_CHECKING:
    from .. import TypeInputUser, TypeSecureValueError



@dataclasses.dataclass(init=False, frozen=True)
class GetFullUser(TLRequest):
    """
    :returns users.UserFull: Instance of UserFull.
    """
    __slots__ = ('id',)
    CONSTRUCTOR_ID = 0xb60f5918
    SUBCLASS_OF_ID = 0x83df9df5

    id: 'TypeInputUser'
    # noinspection PyShadowingBuiltins
    def __init__(self, id: 'TypeInputUser'):
        object.__setattr__(self, 'id', id)

    async def _resolve(self, client, utils):
        r = {}
        r['id'] = utils.get_input_user(await client._get_input_peer(self.id))
        return dataclasses.replace(self, **r)

    def _bytes(self):
        return b''.join((
            b'\x18Y\x0f\xb6',
            self.id._bytes(),
        ))

    @classmethod
    def _from_reader(cls, reader):
        _id = reader.tgread_object()
        return cls(id=_id)


@dataclasses.dataclass(init=False, frozen=True)
class GetUsers(TLRequest):
    """
    :returns Vector<User>: This type has no constructors.
    """
    __slots__ = ('id',)
    CONSTRUCTOR_ID = 0xd91a548
    SUBCLASS_OF_ID = 0x406da4d

    id: List['TypeInputUser']
    # noinspection PyShadowingBuiltins
    def __init__(self, id: List['TypeInputUser']):
        object.__setattr__(self, 'id', id)

    async def _resolve(self, client, utils):
        r = {}
        r['id'] = []
        for x in self.id:
            r['id'].append(utils.get_input_user(await client._get_input_peer(x)))

        return dataclasses.replace(self, **r)

    def _bytes(self):
        return b''.join((
            b'H\xa5\x91\r',
            b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.id)),b''.join(x._bytes() for x in self.id),
        ))

    @classmethod
    def _from_reader(cls, reader):
        reader.read_int()
        _id = []
        for _ in range(reader.read_int()):
            _x = reader.tgread_object()
            _id.append(_x)

        return cls(id=_id)


@dataclasses.dataclass(init=False, frozen=True)
class SetSecureValueErrors(TLRequest):
    """
    :returns Bool: This type has no constructors.
    """
    __slots__ = ('id', 'errors',)
    CONSTRUCTOR_ID = 0x90c894b5
    SUBCLASS_OF_ID = 0xf5b399ac

    id: 'TypeInputUser'
    errors: List['TypeSecureValueError']
    # noinspection PyShadowingBuiltins
    def __init__(self, id: 'TypeInputUser', errors: List['TypeSecureValueError']):
        object.__setattr__(self, 'id', id)
        object.__setattr__(self, 'errors', errors)

    async def _resolve(self, client, utils):
        r = {}
        r['id'] = utils.get_input_user(await client._get_input_peer(self.id))
        return dataclasses.replace(self, **r)

    def _bytes(self):
        return b''.join((
            b'\xb5\x94\xc8\x90',
            self.id._bytes(),
            b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.errors)),b''.join(x._bytes() for x in self.errors),
        ))

    @classmethod
    def _from_reader(cls, reader):
        _id = reader.tgread_object()
        reader.read_int()
        _errors = []
        for _ in range(reader.read_int()):
            _x = reader.tgread_object()
            _errors.append(_x)

        return cls(id=_id, errors=_errors)

