"""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 TypeBotCommand, TypeBotCommandScope, TypeDataJSON



@dataclasses.dataclass(init=False, frozen=True)
class AnswerWebhookJSONQuery(TLRequest):
    """
    :returns Bool: This type has no constructors.
    """
    __slots__ = ('query_id', 'data',)
    CONSTRUCTOR_ID = 0xe6213f4d
    SUBCLASS_OF_ID = 0xf5b399ac

    query_id: int
    data: 'TypeDataJSON'
    def __init__(self, query_id: int, data: 'TypeDataJSON'):
        object.__setattr__(self, 'query_id', query_id)
        object.__setattr__(self, 'data', data)

    def _bytes(self):
        return b''.join((
            b'M?!\xe6',
            struct.pack('<q', self.query_id),
            self.data._bytes(),
        ))

    @classmethod
    def _from_reader(cls, reader):
        _query_id = reader.read_long()
        _data = reader.tgread_object()
        return cls(query_id=_query_id, data=_data)


@dataclasses.dataclass(init=False, frozen=True)
class GetBotCommands(TLRequest):
    """
    :returns Vector<BotCommand>: This type has no constructors.
    """
    __slots__ = ('scope', 'lang_code',)
    CONSTRUCTOR_ID = 0xe34c0dd6
    SUBCLASS_OF_ID = 0xfae91529

    scope: 'TypeBotCommandScope'
    lang_code: str
    def __init__(self, scope: 'TypeBotCommandScope', lang_code: str):
        object.__setattr__(self, 'scope', scope)
        object.__setattr__(self, 'lang_code', lang_code)

    def _bytes(self):
        return b''.join((
            b'\xd6\rL\xe3',
            self.scope._bytes(),
            self._serialize_bytes(self.lang_code),
        ))

    @classmethod
    def _from_reader(cls, reader):
        _scope = reader.tgread_object()
        _lang_code = reader.tgread_string()
        return cls(scope=_scope, lang_code=_lang_code)


@dataclasses.dataclass(init=False, frozen=True)
class ResetBotCommands(TLRequest):
    """
    :returns Bool: This type has no constructors.
    """
    __slots__ = ('scope', 'lang_code',)
    CONSTRUCTOR_ID = 0x3d8de0f9
    SUBCLASS_OF_ID = 0xf5b399ac

    scope: 'TypeBotCommandScope'
    lang_code: str
    def __init__(self, scope: 'TypeBotCommandScope', lang_code: str):
        object.__setattr__(self, 'scope', scope)
        object.__setattr__(self, 'lang_code', lang_code)

    def _bytes(self):
        return b''.join((
            b'\xf9\xe0\x8d=',
            self.scope._bytes(),
            self._serialize_bytes(self.lang_code),
        ))

    @classmethod
    def _from_reader(cls, reader):
        _scope = reader.tgread_object()
        _lang_code = reader.tgread_string()
        return cls(scope=_scope, lang_code=_lang_code)


@dataclasses.dataclass(init=False, frozen=True)
class SendCustomRequest(TLRequest):
    """
    :returns DataJSON: Instance of DataJSON.
    """
    __slots__ = ('custom_method', 'params',)
    CONSTRUCTOR_ID = 0xaa2769ed
    SUBCLASS_OF_ID = 0xad0352e8

    custom_method: str
    params: 'TypeDataJSON'
    def __init__(self, custom_method: str, params: 'TypeDataJSON'):
        object.__setattr__(self, 'custom_method', custom_method)
        object.__setattr__(self, 'params', params)

    def _bytes(self):
        return b''.join((
            b"\xedi'\xaa",
            self._serialize_bytes(self.custom_method),
            self.params._bytes(),
        ))

    @classmethod
    def _from_reader(cls, reader):
        _custom_method = reader.tgread_string()
        _params = reader.tgread_object()
        return cls(custom_method=_custom_method, params=_params)


@dataclasses.dataclass(init=False, frozen=True)
class SetBotCommands(TLRequest):
    """
    :returns Bool: This type has no constructors.
    """
    __slots__ = ('scope', 'lang_code', 'commands',)
    CONSTRUCTOR_ID = 0x517165a
    SUBCLASS_OF_ID = 0xf5b399ac

    scope: 'TypeBotCommandScope'
    lang_code: str
    commands: List['TypeBotCommand']
    def __init__(self, scope: 'TypeBotCommandScope', lang_code: str, commands: List['TypeBotCommand']):
        object.__setattr__(self, 'scope', scope)
        object.__setattr__(self, 'lang_code', lang_code)
        object.__setattr__(self, 'commands', commands)

    def _bytes(self):
        return b''.join((
            b'Z\x16\x17\x05',
            self.scope._bytes(),
            self._serialize_bytes(self.lang_code),
            b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.commands)),b''.join(x._bytes() for x in self.commands),
        ))

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

        return cls(scope=_scope, lang_code=_lang_code, commands=_commands)

