/** * @zendir/ui - useSimulationPlayback Hook * * Hook for managing simulation playback state with play/pause/stop controls. * Designed to work seamlessly with SimulationControls component. * * Features: * - Play/pause/stop state management * - Configurable time scale (playback speed) * - Step forward/backward functionality * - Automatic time updates when playing * - Zendir SDK integration ready * * @example * ```tsx * const sim = useSimulationPlayback({ * epoch: new Date('2026-01-01T00:00:00Z'), * initialElapsedSeconds: 0, * initialTimeScale: 1, * stepSize: 60, // 1 minute steps * }); * * * ``` */ export interface UseSimulationPlaybackOptions { /** Simulation epoch (t=0). Defaults to current date at midnight UTC. */ epoch?: Date | string; /** Initial elapsed seconds from epoch. Defaults to 0. */ initialElapsedSeconds?: number; /** Initial time scale factor. Defaults to 1 (realtime). */ initialTimeScale?: number; /** Step size in seconds for step forward/backward. Defaults to 60 (1 minute). */ stepSize?: number; /** Update interval in milliseconds. Defaults to 1000. */ updateInterval?: number; /** Callback when state changes */ onChange?: (state: SimulationPlaybackState) => void; /** Maximum elapsed seconds (optional upper bound) */ maxElapsedSeconds?: number; /** Whether to loop back to start when max is reached */ loop?: boolean; } export interface SimulationPlaybackState { /** Whether simulation is currently playing */ isPlaying: boolean; /** Whether simulation is paused (not playing but not at start) */ isPaused: boolean; /** Whether simulation is stopped (at start position) */ isStopped: boolean; /** Current time scale factor (playback speed) */ timeScale: number; /** Simulation epoch (t=0) */ epoch: Date; /** Elapsed seconds from epoch */ elapsedSeconds: number; /** Current simulation time as Date */ currentTime: Date; /** Step size in seconds */ stepSize: number; } export interface UseSimulationPlaybackResult extends SimulationPlaybackState { /** Start playing the simulation */ play: () => void; /** Pause the simulation */ pause: () => void; /** Stop and reset to start */ stop: () => void; /** Toggle play/pause state */ toggle: () => void; /** Step forward by stepSize seconds */ stepForward: () => void; /** Step backward by stepSize seconds */ stepBackward: () => void; /** Set time scale (playback speed) */ setTimeScale: (scale: number) => void; /** Set step size in seconds */ setStepSize: (size: number) => void; /** Jump to a specific elapsed time in seconds */ seekTo: (seconds: number) => void; /** Set the epoch (resets elapsed time to 0) */ setEpoch: (epoch: Date | string) => void; } export declare function useSimulationPlayback(options?: UseSimulationPlaybackOptions): UseSimulationPlaybackResult; export default useSimulationPlayback;