class CompressionBackup {
    backup = null;
    timestamp = null;
    // Store a backup of messages before compression
    storeBackup(messages) {
        this.backup = messages.map(msg => ({ ...msg }));
        this.timestamp = Date.now();
    }
    getBackup() {
        return this.backup ? this.backup.map(msg => ({ ...msg })) : null;
    }
    hasBackup() {
        return this.backup !== null;
    }
    getTimestamp() {
        return this.timestamp;
    }
    clearBackup() {
        this.backup = null;
        this.timestamp = null;
    }
    restore() {
        if (!this.backup) {
            return null;
        }
        const restored = this.backup.map(msg => ({ ...msg }));
        return restored;
    }
}
export const compressionBackup = new CompressionBackup();
//# sourceMappingURL=compression-backup.js.map