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



@dataclasses.dataclass(init=False, frozen=True)
class UserFull(TLObject):
    """
    Constructor for users.UserFull: Instance of UserFull.
    """
    __slots__ = ('full_user', 'chats', 'users',)
    CONSTRUCTOR_ID = 0x3b6d152e
    SUBCLASS_OF_ID = 0x83df9df5

    full_user: 'TypeUserFull'
    chats: List['TypeChat']
    users: List['TypeUser']
    def __init__(self, full_user: 'TypeUserFull', chats: List['TypeChat'], users: List['TypeUser']):
        object.__setattr__(self, 'full_user', full_user)
        object.__setattr__(self, 'chats', chats)
        object.__setattr__(self, 'users', users)

    def _bytes(self):
        return b''.join((
            b'.\x15m;',
            self.full_user._bytes(),
            b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.chats)),b''.join(x._bytes() for x in self.chats),
            b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.users)),b''.join(x._bytes() for x in self.users),
        ))

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

        reader.read_int()
        _users = []
        for _ in range(reader.read_int()):
            _x = reader.tgread_object()
            _users.append(_x)

        return cls(full_user=_full_user, chats=_chats, users=_users)

