"""File auto-generated by tglib TL generator. Do not edit manually."""
from ..tlobject import TLObject
from ..tlobject import TLRequest
from typing import Optional, List, Union
import os
import struct
from datetime import datetime


class AcceptTermsOfServiceRequest(TLRequest):
    """TL type: help.acceptTermsOfService"""
    CONSTRUCTOR_ID = 0xee72f79a
    SUBCLASS_OF_ID = 0xf5b399ac

    def __init__(self, id: 'TypeDataJSON'):
        self.id = id

    def to_dict(self):
        return {
            '_': 'AcceptTermsOfServiceRequest',
            'id': self.id,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.id))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_id = reader.tgread_object()
        _args['id'] = _val_id
        return cls(**_args)


class DismissSuggestionRequest(TLRequest):
    """TL type: help.dismissSuggestion"""
    CONSTRUCTOR_ID = 0xf50dbaa1
    SUBCLASS_OF_ID = 0xf5b399ac

    def __init__(self, peer: 'TypeInputPeer', suggestion: str):
        self.peer = peer
        self.suggestion = suggestion

    def to_dict(self):
        return {
            '_': 'DismissSuggestionRequest',
            'peer': self.peer,
            'suggestion': self.suggestion,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.peer))
        buf.write(TLObject.serialize_bytes(self.suggestion))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_peer = reader.tgread_object()
        _args['peer'] = _val_peer
        _val_suggestion = reader.tgread_string()
        _args['suggestion'] = _val_suggestion
        return cls(**_args)


class EditUserInfoRequest(TLRequest):
    """TL type: help.editUserInfo"""
    CONSTRUCTOR_ID = 0x66b91b70
    SUBCLASS_OF_ID = 0x5c53d7d8

    def __init__(self, user_id: 'TypeInputUser', message: str, entities: List['TypeMessageEntity']):
        self.user_id = user_id
        self.message = message
        self.entities = entities

    def to_dict(self):
        return {
            '_': 'EditUserInfoRequest',
            'user_id': self.user_id,
            'message': self.message,
            'entities': self.entities,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.user_id))
        buf.write(TLObject.serialize_bytes(self.message))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.entities)))
        for item in self.entities:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_user_id = reader.tgread_object()
        _args['user_id'] = _val_user_id
        _val_message = reader.tgread_string()
        _args['message'] = _val_message
        reader.read_int(signed=False)  # skip vector id
        _count_entities = reader.read_int()
        _list_entities = []
        for _ in range(_count_entities):
            _item_entities = reader.tgread_object()
            _list_entities.append(_item_entities)
        _args['entities'] = _list_entities
        return cls(**_args)


class GetAppConfigRequest(TLRequest):
    """TL type: help.getAppConfig"""
    CONSTRUCTOR_ID = 0x61e3f854
    SUBCLASS_OF_ID = 0x14381c9a

    def __init__(self, hash: int):
        self.hash = hash

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

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.hash))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_int()
        _args['hash'] = _val_hash
        return cls(**_args)


class GetAppUpdateRequest(TLRequest):
    """TL type: help.getAppUpdate"""
    CONSTRUCTOR_ID = 0x522d5a7d
    SUBCLASS_OF_ID = 0x5897069e

    def __init__(self, source: str):
        self.source = source

    def to_dict(self):
        return {
            '_': 'GetAppUpdateRequest',
            'source': self.source,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(TLObject.serialize_bytes(self.source))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_source = reader.tgread_string()
        _args['source'] = _val_source
        return cls(**_args)


class GetCdnConfigRequest(TLRequest):
    """TL type: help.getCdnConfig"""
    CONSTRUCTOR_ID = 0x52029342
    SUBCLASS_OF_ID = 0xecda397c

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'GetCdnConfigRequest',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class GetConfigRequest(TLRequest):
    """TL type: help.getConfig"""
    CONSTRUCTOR_ID = 0xc4f9186b
    SUBCLASS_OF_ID = 0xd3262a4a

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'GetConfigRequest',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class GetCountriesListRequest(TLRequest):
    """TL type: help.getCountriesList"""
    CONSTRUCTOR_ID = 0x735787a8
    SUBCLASS_OF_ID = 0xea31fe88

    def __init__(self, lang_code: str, hash: int):
        self.lang_code = lang_code
        self.hash = hash

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

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(TLObject.serialize_bytes(self.lang_code))
        buf.write(struct.pack('<i', self.hash))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_lang_code = reader.tgread_string()
        _args['lang_code'] = _val_lang_code
        _val_hash = reader.read_int()
        _args['hash'] = _val_hash
        return cls(**_args)


class GetDeepLinkInfoRequest(TLRequest):
    """TL type: help.getDeepLinkInfo"""
    CONSTRUCTOR_ID = 0x3fedc75f
    SUBCLASS_OF_ID = 0x984aac38

    def __init__(self, path: str):
        self.path = path

    def to_dict(self):
        return {
            '_': 'GetDeepLinkInfoRequest',
            'path': self.path,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(TLObject.serialize_bytes(self.path))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_path = reader.tgread_string()
        _args['path'] = _val_path
        return cls(**_args)


class GetInviteTextRequest(TLRequest):
    """TL type: help.getInviteText"""
    CONSTRUCTOR_ID = 0x4d392343
    SUBCLASS_OF_ID = 0xcf70aa35

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'GetInviteTextRequest',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class GetNearestDcRequest(TLRequest):
    """TL type: help.getNearestDc"""
    CONSTRUCTOR_ID = 0x1fb33026
    SUBCLASS_OF_ID = 0x3877045f

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'GetNearestDcRequest',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class GetPassportConfigRequest(TLRequest):
    """TL type: help.getPassportConfig"""
    CONSTRUCTOR_ID = 0xc661ad08
    SUBCLASS_OF_ID = 0xc666c0ad

    def __init__(self, hash: int):
        self.hash = hash

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

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.hash))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_int()
        _args['hash'] = _val_hash
        return cls(**_args)


class GetPeerColorsRequest(TLRequest):
    """TL type: help.getPeerColors"""
    CONSTRUCTOR_ID = 0xda80f42f
    SUBCLASS_OF_ID = 0x0e3f6733

    def __init__(self, hash: int):
        self.hash = hash

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

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.hash))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_int()
        _args['hash'] = _val_hash
        return cls(**_args)


class GetPeerProfileColorsRequest(TLRequest):
    """TL type: help.getPeerProfileColors"""
    CONSTRUCTOR_ID = 0xabcfa9fd
    SUBCLASS_OF_ID = 0x0e3f6733

    def __init__(self, hash: int):
        self.hash = hash

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

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.hash))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_int()
        _args['hash'] = _val_hash
        return cls(**_args)


class GetPremiumPromoRequest(TLRequest):
    """TL type: help.getPremiumPromo"""
    CONSTRUCTOR_ID = 0xb81b93d4
    SUBCLASS_OF_ID = 0xc987a338

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'GetPremiumPromoRequest',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class GetPromoDataRequest(TLRequest):
    """TL type: help.getPromoData"""
    CONSTRUCTOR_ID = 0xc0977421
    SUBCLASS_OF_ID = 0x9d595542

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'GetPromoDataRequest',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class GetRecentMeUrlsRequest(TLRequest):
    """TL type: help.getRecentMeUrls"""
    CONSTRUCTOR_ID = 0x3dc0f114
    SUBCLASS_OF_ID = 0xf269c477

    def __init__(self, referer: str):
        self.referer = referer

    def to_dict(self):
        return {
            '_': 'GetRecentMeUrlsRequest',
            'referer': self.referer,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(TLObject.serialize_bytes(self.referer))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_referer = reader.tgread_string()
        _args['referer'] = _val_referer
        return cls(**_args)


class GetSupportRequest(TLRequest):
    """TL type: help.getSupport"""
    CONSTRUCTOR_ID = 0x9cdf08cd
    SUBCLASS_OF_ID = 0x7159bceb

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'GetSupportRequest',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class GetSupportNameRequest(TLRequest):
    """TL type: help.getSupportName"""
    CONSTRUCTOR_ID = 0xd360e72c
    SUBCLASS_OF_ID = 0x7f50b7c2

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'GetSupportNameRequest',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class GetTermsOfServiceUpdateRequest(TLRequest):
    """TL type: help.getTermsOfServiceUpdate"""
    CONSTRUCTOR_ID = 0x2ca51fd1
    SUBCLASS_OF_ID = 0x293c2977

    def __init__(self):
        pass

    def to_dict(self):
        return {
            '_': 'GetTermsOfServiceUpdateRequest',
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        return cls()


class GetTimezonesListRequest(TLRequest):
    """TL type: help.getTimezonesList"""
    CONSTRUCTOR_ID = 0x49b30240
    SUBCLASS_OF_ID = 0xca76e475

    def __init__(self, hash: int):
        self.hash = hash

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

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.hash))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_hash = reader.read_int()
        _args['hash'] = _val_hash
        return cls(**_args)


class GetUserInfoRequest(TLRequest):
    """TL type: help.getUserInfo"""
    CONSTRUCTOR_ID = 0x038a08d3
    SUBCLASS_OF_ID = 0x5c53d7d8

    def __init__(self, user_id: 'TypeInputUser'):
        self.user_id = user_id

    def to_dict(self):
        return {
            '_': 'GetUserInfoRequest',
            'user_id': self.user_id,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.user_id))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_user_id = reader.tgread_object()
        _args['user_id'] = _val_user_id
        return cls(**_args)


class HidePromoDataRequest(TLRequest):
    """TL type: help.hidePromoData"""
    CONSTRUCTOR_ID = 0x1e251c95
    SUBCLASS_OF_ID = 0xf5b399ac

    def __init__(self, peer: 'TypeInputPeer'):
        self.peer = peer

    def to_dict(self):
        return {
            '_': 'HidePromoDataRequest',
            'peer': self.peer,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(bytes(self.peer))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_peer = reader.tgread_object()
        _args['peer'] = _val_peer
        return cls(**_args)


class SaveAppLogRequest(TLRequest):
    """TL type: help.saveAppLog"""
    CONSTRUCTOR_ID = 0x6f02f748
    SUBCLASS_OF_ID = 0xf5b399ac

    def __init__(self, events: List['TypeInputAppEvent']):
        self.events = events

    def to_dict(self):
        return {
            '_': 'SaveAppLogRequest',
            'events': self.events,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', 0x1cb5c415))  # vector id
        buf.write(struct.pack('<i', len(self.events)))
        for item in self.events:
            buf.write(bytes(self.item))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        reader.read_int(signed=False)  # skip vector id
        _count_events = reader.read_int()
        _list_events = []
        for _ in range(_count_events):
            _item_events = reader.tgread_object()
            _list_events.append(_item_events)
        _args['events'] = _list_events
        return cls(**_args)


class SetBotUpdatesStatusRequest(TLRequest):
    """TL type: help.setBotUpdatesStatus"""
    CONSTRUCTOR_ID = 0xec22cfcd
    SUBCLASS_OF_ID = 0xf5b399ac

    def __init__(self, pending_updates_count: int, message: str):
        self.pending_updates_count = pending_updates_count
        self.message = message

    def to_dict(self):
        return {
            '_': 'SetBotUpdatesStatusRequest',
            'pending_updates_count': self.pending_updates_count,
            'message': self.message,
        }

    def _bytes(self) -> bytes:
        import io
        buf = io.BytesIO()
        buf.write(struct.pack('<I', self.CONSTRUCTOR_ID))
        buf.write(struct.pack('<i', self.pending_updates_count))
        buf.write(TLObject.serialize_bytes(self.message))
        return buf.getvalue()

    @classmethod
    def from_reader(cls, reader):
        _args = {}
        _val_pending_updates_count = reader.read_int()
        _args['pending_updates_count'] = _val_pending_updates_count
        _val_message = reader.tgread_string()
        _args['message'] = _val_message
        return cls(**_args)

