import SwiftUI
/// A single command the ambient player understands, regardless of source. Today the
/// Siri Remote (T1) feeds these; the T2 phone controller will decode network messages
/// into the SAME intents, so the player's command surface never forks.
enum ControlIntent: Equatable, Codable {
case next
case previous
case togglePlaylist // pin the current preset ↔ resume auto-cycling
case jumpTo(String) // preset id
case showOverlay
case dismissOverlay
}
/// Pure mapping from a SwiftUI move command (Siri Remote swipe / directional click) to
/// an intent. Lives here (not in the view) so it is unit-testable on the macOS host.
/// `MoveCommandDirection` is a struct with static members (not an enum), so compare with `==`.
/// `MoveCommandDirection`/`onMoveCommand` exist only on tvOS + macOS (Siri Remote /
/// keyboard arrows); iOS has no move-command source, so this mapping is excluded there
/// (the `ControlIntent` enum above stays platform-agnostic). The macOS host keeps it,
/// so `ControlIntentTests` still exercises the mapping.
#if os(tvOS) || os(macOS)
func remoteMoveIntent(_ direction: MoveCommandDirection) -> ControlIntent? {
if direction == .left { return .previous }
if direction == .right { return .next }
if direction == .up { return .showOverlay }
if direction == .down { return .dismissOverlay }
return nil
}
#endif