package com.onthelevel.core.sensors

import kotlinx.coroutines.flow.Flow

/**
 * The seam between Android sensor I/O and the pure measurement math. Tests inject
 * fakes emitting synthetic or recorded traces (BRIEF.md §Testability).
 */
interface SensorSource {
    /** False on devices with no usable tilt sensor: show the unsupported-device state. */
    val isAvailable: Boolean

    /** Which physical sensor backs [gravity]; surfaced in the header status line. */
    val kind: Kind

    /**
     * Device-frame gravity stream. Cold: registering happens on collection and
     * unregistering on cancellation, so lifecycle-aware collection automatically
     * satisfies "sensors registered only while a relevant screen is foregrounded".
     */
    val gravity: Flow<GravitySample>

    enum class Kind { GAME_ROTATION_VECTOR, GRAVITY, ACCELEROMETER, NONE }
}
