"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject


class GetCdnFileRequest(TLObject):
    constructor_id = 0x2000bcc3
    subclass_of_id = 0xf5ccf928

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

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

        self.file_token = file_token
        self.offset = offset
        self.limit = limit

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

    def on_send(self, writer):
        writer.write_int(GetCdnFileRequest.constructor_id, signed=False)
        writer.tgwrite_bytes(self.file_token)
        writer.write_int(self.offset)
        writer.write_int(self.limit)

    @staticmethod
    def empty():
        return GetCdnFileRequest(None, None, None)

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)



class GetCdnFileHashesRequest(TLObject):
    constructor_id = 0xf715c87b
    subclass_of_id = 0x7ec58e40

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

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

        self.file_token = file_token
        self.offset = offset

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

    def on_send(self, writer):
        writer.write_int(GetCdnFileHashesRequest.constructor_id, signed=False)
        writer.tgwrite_bytes(self.file_token)
        writer.write_int(self.offset)

    @staticmethod
    def empty():
        return GetCdnFileHashesRequest(None, None)

    def on_response(self, reader):
        self.result = reader.tgread_vector()

    def __repr__(self):
        return 'upload.getCdnFileHashes#f715c87b file_token:bytes offset:int = Vector<CdnFileHash>'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)



class GetFileRequest(TLObject):
    constructor_id = 0xe3a6cfb5
    subclass_of_id = 0x6c9bd728

    def __init__(self, location, offset, limit):
        """
        :param location: Telegram type: "InputFileLocation".
        :param offset: Telegram type: "int".
        :param limit: Telegram type: "int".

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

        self.location = location
        self.offset = offset
        self.limit = limit

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

    def on_send(self, writer):
        writer.write_int(GetFileRequest.constructor_id, signed=False)
        self.location.on_send(writer)
        writer.write_int(self.offset)
        writer.write_int(self.limit)

    @staticmethod
    def empty():
        return GetFileRequest(None, None, None)

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)



class GetWebFileRequest(TLObject):
    constructor_id = 0x24e6818d
    subclass_of_id = 0x68f17f51

    def __init__(self, location, offset, limit):
        """
        :param location: Telegram type: "InputWebFileLocation".
        :param offset: Telegram type: "int".
        :param limit: Telegram type: "int".

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

        self.location = location
        self.offset = offset
        self.limit = limit

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

    def on_send(self, writer):
        writer.write_int(GetWebFileRequest.constructor_id, signed=False)
        self.location.on_send(writer)
        writer.write_int(self.offset)
        writer.write_int(self.limit)

    @staticmethod
    def empty():
        return GetWebFileRequest(None, None, None)

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)



class ReuploadCdnFileRequest(TLObject):
    constructor_id = 0x1af91c09
    subclass_of_id = 0x7ec58e40

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

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

        self.file_token = file_token
        self.request_token = request_token

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

    def on_send(self, writer):
        writer.write_int(ReuploadCdnFileRequest.constructor_id, signed=False)
        writer.tgwrite_bytes(self.file_token)
        writer.tgwrite_bytes(self.request_token)

    @staticmethod
    def empty():
        return ReuploadCdnFileRequest(None, None)

    def on_response(self, reader):
        self.result = reader.tgread_vector()

    def __repr__(self):
        return 'upload.reuploadCdnFile#1af91c09 file_token:bytes request_token:bytes = Vector<CdnFileHash>'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)



class SaveBigFilePartRequest(TLObject):
    constructor_id = 0xde7b673d
    subclass_of_id = 0xf5b399ac

    def __init__(self, file_id, file_part, file_total_parts, bytes):
        """
        :param file_id: Telegram type: "long".
        :param file_part: Telegram type: "int".
        :param file_total_parts: Telegram type: "int".
        :param bytes: Telegram type: "bytes".

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

        self.file_id = file_id
        self.file_part = file_part
        self.file_total_parts = file_total_parts
        self.bytes = bytes

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

    def on_send(self, writer):
        writer.write_int(SaveBigFilePartRequest.constructor_id, signed=False)
        writer.write_long(self.file_id)
        writer.write_int(self.file_part)
        writer.write_int(self.file_total_parts)
        writer.tgwrite_bytes(self.bytes)

    @staticmethod
    def empty():
        return SaveBigFilePartRequest(None, None, None, None)

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)



class SaveFilePartRequest(TLObject):
    constructor_id = 0xb304a621
    subclass_of_id = 0xf5b399ac

    def __init__(self, file_id, file_part, bytes):
        """
        :param file_id: Telegram type: "long".
        :param file_part: Telegram type: "int".
        :param bytes: Telegram type: "bytes".

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

        self.file_id = file_id
        self.file_part = file_part
        self.bytes = bytes

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

    def on_send(self, writer):
        writer.write_int(SaveFilePartRequest.constructor_id, signed=False)
        writer.write_long(self.file_id)
        writer.write_int(self.file_part)
        writer.tgwrite_bytes(self.bytes)

    @staticmethod
    def empty():
        return SaveFilePartRequest(None, None, None)

    def on_response(self, reader):
        self.result = reader.tgread_object()

    def __repr__(self):
        return 'upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool'

    def __str__(self):
        return TLObject.pretty_format(self)

    def stringify(self):
        return TLObject.pretty_format(self, indent=0)

