import Foundation
/// Pure throttle decision for the editor-remote sender: `params` are coalesced to at most one send
/// per `minParamInterval` (LAN-smooth, avoids flooding the ATV while a slider drags); selection and
/// intents are discrete events and always pass. Time is injected so it is host-testable. The
/// interval is measured from the last *send*, so dropped attempts never reset the clock.
struct RemoteSendGate {
let minParamInterval: TimeInterval
private var lastParamSend: TimeInterval = -.greatestFiniteMagnitude
init(minParamInterval: TimeInterval) { self.minParamInterval = minParamInterval }
mutating func allowParams(at now: TimeInterval) -> Bool {
guard now - lastParamSend >= minParamInterval else { return false }
lastParamSend = now
return true
}
func allowSelection() -> Bool { true }
}