import SwiftUI
import PhysarumEngine
/// A frame-consistent capture of the live player's sim + echo state, plus the
/// render context needed to reproduce the on-screen look at any export size.
struct LiveSnapshot {
let sim: SimState
let feedback: FeedbackState?
let field: FieldSize
let preset: PresetParams
let format: SimFormat
let cover: Bool
}
/// Bridges the SwiftUI-owned RenderCoordinator (created in MetalView.makeCoordinator)
/// to views that need a snapshot (CaptureSheet, the save flow). MetalView.sync sets
/// `coordinator`; callers use `takeSnapshot()`. Weak so it never retains the coordinator.
@Observable
final class LiveSnapshotProvider {
weak var coordinator: RenderCoordinator?
func takeSnapshot() -> LiveSnapshot? { coordinator?.takeSnapshot() ?? nil }
}