import Foundation /// Offload report renderers: CSV (machine) + HTML (producer handoff). public enum OffloadReportWriter { public static func csv(_ report: OffloadReport) -> String { var out = "relative_path,size,xxh64,verified,skipped\n" for f in report.files { out += "\(f.relativePath),\(f.size),\(f.xxh64),\(f.verified),\(f.skipped)\n" } return out } public static func formatBytes(_ bytes: UInt64) -> String { let mb = Double(bytes) / 1_000_000 if mb >= 1000 { return String(format: "%.2f GB", mb / 1000) } return String(format: "%.1f MB", mb) } public static func html(_ report: OffloadReport) -> String { let allVerified = report.files.allSatisfy(\.verified) var rows = "" for f in report.files { rows += """
\(f.xxh64)Source: \(report.source)
Destinations: \(report.destinations.joined(separator: ", "))
\(report.files.count) files, \(formatBytes(report.totalBytes)), \(String(format: "%.1f", report.duration))s
| File | Size | xxHash64 | Verify | Action |
|---|