"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
from typing import Optional, List, Union, TYPE_CHECKING
import os
import struct
if TYPE_CHECKING:
    from ...tl.types import TypeInputWebFileLocation, TypeInputFileLocation



class GetCdnFileRequest(TLObject):
    CONSTRUCTOR_ID = 0x2000bcc3
    SUBCLASS_OF_ID = 0xf5ccf928

    def __init__(self, file_token, offset, limit):
        """
        :param bytes file_token:
        :param int offset:
        :param int limit:

        :returns upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.file_token = file_token  # type: bytes
        self.offset = offset  # type: int
        self.limit = limit  # type: int

    def to_dict(self):
        return {
            '_': 'GetCdnFileRequest',
            'file_token': self.file_token,
            'offset': self.offset,
            'limit': self.limit
        }

    def __bytes__(self):
        return b''.join((
            b'\xc3\xbc\x00 ',
            TLObject.serialize_bytes(self.file_token),
            struct.pack('<i', self.offset),
            struct.pack('<i', self.limit),
        ))

    @classmethod
    def from_reader(cls, reader):
        _file_token = reader.tgread_bytes()
        _offset = reader.read_int()
        _limit = reader.read_int()
        return cls(file_token=_file_token, offset=_offset, limit=_limit)


class GetCdnFileHashesRequest(TLObject):
    CONSTRUCTOR_ID = 0x4da54231
    SUBCLASS_OF_ID = 0xa5940726

    def __init__(self, file_token, offset):
        """
        :param bytes file_token:
        :param int offset:

        :returns Vector<FileHash>: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.file_token = file_token  # type: bytes
        self.offset = offset  # type: int

    def to_dict(self):
        return {
            '_': 'GetCdnFileHashesRequest',
            'file_token': self.file_token,
            'offset': self.offset
        }

    def __bytes__(self):
        return b''.join((
            b'1B\xa5M',
            TLObject.serialize_bytes(self.file_token),
            struct.pack('<i', self.offset),
        ))

    @classmethod
    def from_reader(cls, reader):
        _file_token = reader.tgread_bytes()
        _offset = reader.read_int()
        return cls(file_token=_file_token, offset=_offset)


class GetFileRequest(TLObject):
    CONSTRUCTOR_ID = 0xe3a6cfb5
    SUBCLASS_OF_ID = 0x6c9bd728

    def __init__(self, location, offset, limit):
        """
        :param TypeInputFileLocation location:
        :param int offset:
        :param int limit:

        :returns upload.File: Instance of either File, FileCdnRedirect.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.location = location  # type: TypeInputFileLocation
        self.offset = offset  # type: int
        self.limit = limit  # type: int

    def to_dict(self):
        return {
            '_': 'GetFileRequest',
            'location': None if self.location is None else self.location.to_dict(),
            'offset': self.offset,
            'limit': self.limit
        }

    def __bytes__(self):
        return b''.join((
            b'\xb5\xcf\xa6\xe3',
            bytes(self.location),
            struct.pack('<i', self.offset),
            struct.pack('<i', self.limit),
        ))

    @classmethod
    def from_reader(cls, reader):
        _location = reader.tgread_object()
        _offset = reader.read_int()
        _limit = reader.read_int()
        return cls(location=_location, offset=_offset, limit=_limit)


class GetFileHashesRequest(TLObject):
    CONSTRUCTOR_ID = 0xc7025931
    SUBCLASS_OF_ID = 0xa5940726

    def __init__(self, location, offset):
        """
        :param TypeInputFileLocation location:
        :param int offset:

        :returns Vector<FileHash>: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.location = location  # type: TypeInputFileLocation
        self.offset = offset  # type: int

    def to_dict(self):
        return {
            '_': 'GetFileHashesRequest',
            'location': None if self.location is None else self.location.to_dict(),
            'offset': self.offset
        }

    def __bytes__(self):
        return b''.join((
            b'1Y\x02\xc7',
            bytes(self.location),
            struct.pack('<i', self.offset),
        ))

    @classmethod
    def from_reader(cls, reader):
        _location = reader.tgread_object()
        _offset = reader.read_int()
        return cls(location=_location, offset=_offset)


class GetWebFileRequest(TLObject):
    CONSTRUCTOR_ID = 0x24e6818d
    SUBCLASS_OF_ID = 0x68f17f51

    def __init__(self, location, offset, limit):
        """
        :param TypeInputWebFileLocation location:
        :param int offset:
        :param int limit:

        :returns upload.WebFile: Instance of WebFile.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.location = location  # type: TypeInputWebFileLocation
        self.offset = offset  # type: int
        self.limit = limit  # type: int

    def to_dict(self):
        return {
            '_': 'GetWebFileRequest',
            'location': None if self.location is None else self.location.to_dict(),
            'offset': self.offset,
            'limit': self.limit
        }

    def __bytes__(self):
        return b''.join((
            b'\x8d\x81\xe6$',
            bytes(self.location),
            struct.pack('<i', self.offset),
            struct.pack('<i', self.limit),
        ))

    @classmethod
    def from_reader(cls, reader):
        _location = reader.tgread_object()
        _offset = reader.read_int()
        _limit = reader.read_int()
        return cls(location=_location, offset=_offset, limit=_limit)


class ReuploadCdnFileRequest(TLObject):
    CONSTRUCTOR_ID = 0x9b2754a8
    SUBCLASS_OF_ID = 0xa5940726

    def __init__(self, file_token, request_token):
        """
        :param bytes file_token:
        :param bytes request_token:

        :returns Vector<FileHash>: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.file_token = file_token  # type: bytes
        self.request_token = request_token  # type: bytes

    def to_dict(self):
        return {
            '_': 'ReuploadCdnFileRequest',
            'file_token': self.file_token,
            'request_token': self.request_token
        }

    def __bytes__(self):
        return b''.join((
            b"\xa8T'\x9b",
            TLObject.serialize_bytes(self.file_token),
            TLObject.serialize_bytes(self.request_token),
        ))

    @classmethod
    def from_reader(cls, reader):
        _file_token = reader.tgread_bytes()
        _request_token = reader.tgread_bytes()
        return cls(file_token=_file_token, request_token=_request_token)


class SaveBigFilePartRequest(TLObject):
    CONSTRUCTOR_ID = 0xde7b673d
    SUBCLASS_OF_ID = 0xf5b399ac

    def __init__(self, file_id, file_part, file_total_parts, bytes):
        """
        :param int file_id:
        :param int file_part:
        :param int file_total_parts:
        :param bytes bytes:

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.file_id = file_id  # type: int
        self.file_part = file_part  # type: int
        self.file_total_parts = file_total_parts  # type: int
        self.bytes = bytes  # type: bytes

    def to_dict(self):
        return {
            '_': 'SaveBigFilePartRequest',
            'file_id': self.file_id,
            'file_part': self.file_part,
            'file_total_parts': self.file_total_parts,
            'bytes': self.bytes
        }

    def __bytes__(self):
        return b''.join((
            b'=g{\xde',
            struct.pack('<q', self.file_id),
            struct.pack('<i', self.file_part),
            struct.pack('<i', self.file_total_parts),
            TLObject.serialize_bytes(self.bytes),
        ))

    @classmethod
    def from_reader(cls, reader):
        _file_id = reader.read_long()
        _file_part = reader.read_int()
        _file_total_parts = reader.read_int()
        _bytes = reader.tgread_bytes()
        return cls(file_id=_file_id, file_part=_file_part, file_total_parts=_file_total_parts, bytes=_bytes)


class SaveFilePartRequest(TLObject):
    CONSTRUCTOR_ID = 0xb304a621
    SUBCLASS_OF_ID = 0xf5b399ac

    def __init__(self, file_id, file_part, bytes):
        """
        :param int file_id:
        :param int file_part:
        :param bytes bytes:

        :returns Bool: This type has no constructors.
        """
        super().__init__()
        self.result = None
        self.content_related = True

        self.file_id = file_id  # type: int
        self.file_part = file_part  # type: int
        self.bytes = bytes  # type: bytes

    def to_dict(self):
        return {
            '_': 'SaveFilePartRequest',
            'file_id': self.file_id,
            'file_part': self.file_part,
            'bytes': self.bytes
        }

    def __bytes__(self):
        return b''.join((
            b'!\xa6\x04\xb3',
            struct.pack('<q', self.file_id),
            struct.pack('<i', self.file_part),
            TLObject.serialize_bytes(self.bytes),
        ))

    @classmethod
    def from_reader(cls, reader):
        _file_id = reader.read_long()
        _file_part = reader.read_int()
        _bytes = reader.tgread_bytes()
        return cls(file_id=_file_id, file_part=_file_part, bytes=_bytes)

