import Foundation /// 单个模型的下载阶段。 enum DownloadPhase: Equatable, Sendable { case idle // 待下载 case downloading // 下载中 case verifying // 校验中 case ready // 已就绪 case failed(String) // 失败 · 可重试 } /// 单个模型的下载状态快照,供 UI 观察。 struct DownloadState: Equatable, Sendable { var phase: DownloadPhase var receivedBytes: Int var totalBytes: Int var bytesPerSecond: Double var fraction: Double { totalBytes > 0 ? Double(receivedBytes) / Double(totalBytes) : 0 } }