from ....tl.mtproto_request import MTProtoRequest


class CdnFile(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile"""

    # Telegram's constructor (U)ID for this class
    constructor_id = 0xa99fca4f
    # Also the ID of its resulting type for fast checks
    subclass_of_id = 0xf5ccf928

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

        Constructor for upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile.
        """
        super().__init__()

        self.bytes = bytes

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

    def on_send(self, writer):
        writer.write_int(CdnFile.constructor_id, signed=False)
        writer.tgwrite_bytes(self.bytes)

    @staticmethod
    def empty():
        """Returns an "empty" instance (attributes=None)"""
        return CdnFile(None)

    def on_response(self, reader):
        self.bytes = reader.tgread_bytes()

    def __repr__(self):
        return 'upload.cdnFile#a99fca4f bytes:bytes = upload.CdnFile'

    def __str__(self):
        return '(upload.cdnFile (ID: 0xa99fca4f) = (bytes={}))'.format(str(self.bytes))
