from ...tl.mtproto_request import MTProtoRequest


class InputEncryptedFileUploaded(MTProtoRequest):
    """Class generated by TLObjects' generator. All changes will be ERASED. Original .tl definition below.
    inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile"""

    # Telegram's constructor ID (and unique identifier) for this class
    constructor_id = 0x64bd0306

    def __init__(self, id, parts, md5_checksum, key_fingerprint):
        """
        :param id: Telegram type: «long».
        :param parts: Telegram type: «int».
        :param md5_checksum: Telegram type: «string».
        :param key_fingerprint: Telegram type: «int».

        Constructor for InputEncryptedFile: Instance of either InputEncryptedFileEmpty, InputEncryptedFileUploaded, InputEncryptedFile, InputEncryptedFileBigUploaded.
        """
        super().__init__()

        self.id = id
        self.parts = parts
        self.md5_checksum = md5_checksum
        self.key_fingerprint = key_fingerprint

    def on_send(self, writer):
        writer.write_int(InputEncryptedFileUploaded.constructor_id, signed=False)
        writer.write_long(self.id)
        writer.write_int(self.parts)
        writer.tgwrite_string(self.md5_checksum)
        writer.write_int(self.key_fingerprint)

    @staticmethod
    def empty():
        """Returns an "empty" instance (all attributes are None)"""
        return InputEncryptedFileUploaded(None, None, None, None)

    def on_response(self, reader):
        self.id = reader.read_long()
        self.parts = reader.read_int()
        self.md5_checksum = reader.tgread_string()
        self.key_fingerprint = reader.read_int()

    def __repr__(self):
        return 'inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile'

    def __str__(self):
        return '(inputEncryptedFileUploaded (ID: 0x64bd0306) = (id={}, parts={}, md5_checksum={}, key_fingerprint={}))'.format(str(self.id), str(self.parts), str(self.md5_checksum), str(self.key_fingerprint))
