package wang.yaojia.webterm.session

import wang.yaojia.webterm.wire.StatusTelemetry

/**
 * A6's half of the [SessionEvent] sealed hierarchy: the COCKPIT subtypes, appended here per the
 * split-file ownership A5 reserved in `SessionEvent.kt` (Kotlin allows a sealed hierarchy to be
 * extended within the same module+package, and these subtypes carry A6-owned payloads —
 * [GateState] / [AwayDigest] — so they live with A6's reducers). Every subtype is TOP-LEVEL so the
 * UI reads `is Gate`, `is Digest`, `is Telemetry` uniformly alongside A5's `is Output` etc.
 *
 * Ports the iOS `SessionEvent.gate` / `.digest` / `.telemetry` cases 1:1.
 */

/**
 * The held permission gate changed; `null` = gate lifted ([GateTracker]). Carries the epoch the UI
 * must hand back when deciding (the stale-guard, [GateState.epoch]).
 */
public data class Gate(val gate: GateState?) : SessionEvent

/**
 * "What happened while I was away" — emitted exactly ONCE after each completed reconnect, reduced
 * over the events since the disconnect moment ([AwayDigest.reduce]). An [AwayDigest.isEmpty] digest
 * is still delivered; the UI suppresses rendering it (all-zero suppressed).
 */
public data class Digest(val digest: AwayDigest) : SessionEvent

/** Latest statusLine telemetry broadcast (mirrors the server `telemetry` frame, B2). */
public data class Telemetry(val telemetry: StatusTelemetry) : SessionEvent
