from ...tl.tlobject import TLObject


class EncryptedFile(TLObject):
    """Class generated by TLObjects' generator. All changes will be ERASED. TL definition below.
    encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile"""

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

    def __init__(self, id, access_hash, size, dc_id, key_fingerprint):
        """
        :param id: Telegram type: "long".
        :param access_hash: Telegram type: "long".
        :param size: Telegram type: "int".
        :param dc_id: Telegram type: "int".
        :param key_fingerprint: Telegram type: "int".

        Constructor for EncryptedFile: Instance of either EncryptedFileEmpty, EncryptedFile.
        """
        super().__init__()

        self.id = id
        self.access_hash = access_hash
        self.size = size
        self.dc_id = dc_id
        self.key_fingerprint = key_fingerprint

    def to_dict(self):
        return {
            'id': self.id,
            'access_hash': self.access_hash,
            'size': self.size,
            'dc_id': self.dc_id,
            'key_fingerprint': self.key_fingerprint,
        }

    def on_send(self, writer):
        writer.write_int(EncryptedFile.constructor_id, signed=False)
        writer.write_long(self.id)
        writer.write_long(self.access_hash)
        writer.write_int(self.size)
        writer.write_int(self.dc_id)
        writer.write_int(self.key_fingerprint)

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

    def on_response(self, reader):
        self.id = reader.read_long()
        self.access_hash = reader.read_long()
        self.size = reader.read_int()
        self.dc_id = reader.read_int()
        self.key_fingerprint = reader.read_int()

    def __repr__(self):
        return 'encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile'

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

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