"""File generated by TLObjects' generator. All changes will be ERASED"""
from ...tl.tlobject import TLObject
from ...utils import get_input_peer, get_input_channel, get_input_user, get_input_media
import os
import struct


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
        self.offset = offset
        self.limit = limit

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

    def to_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),
        ))

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

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

    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 bytes file_token:
        :param int offset:

        :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, recursive=True):
        return {
            'file_token': self.file_token,
            'offset': self.offset,
        }

    def to_bytes(self):
        return b''.join((
            b'{\xc8\x15\xf7',
            TLObject.serialize_bytes(self.file_token),
            struct.pack('<i', self.offset),
        ))

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

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

    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 TLObject 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
        self.offset = offset
        self.limit = limit

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

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

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

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

    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 TLObject 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
        self.offset = offset
        self.limit = limit

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

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

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

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

    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 bytes file_token:
        :param bytes request_token:

        :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, recursive=True):
        return {
            'file_token': self.file_token,
            'request_token': self.request_token,
        }

    def to_bytes(self):
        return b''.join((
            b'\t\x1c\xf9\x1a',
            TLObject.serialize_bytes(self.file_token),
            TLObject.serialize_bytes(self.request_token),
        ))

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

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

    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 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
        self.file_part = file_part
        self.file_total_parts = file_total_parts
        self.bytes = bytes

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

    def to_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),
        ))

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

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

    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 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
        self.file_part = file_part
        self.bytes = bytes

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

    def to_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),
        ))

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

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

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

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