/**
 * Session emitters — typed emission wrappers for SessionEvent domain.
 *
 * Import and call these instead of emitting raw strings.
 */
import { createEventEnvelope } from '@pellux/goodvibes-sdk/platform/runtime/events/envelope';
// ---------------------------------------------------------------------------
// Internal helper
// ---------------------------------------------------------------------------
/**
 * Creates a typed session event envelope, reducing boilerplate across the
 * 7 public wrapper functions below.
 */
function sessionEvent(type, data, ctx) {
    return createEventEnvelope(type, { type, ...data }, ctx);
}
// ---------------------------------------------------------------------------
// Public typed emitter wrappers
// ---------------------------------------------------------------------------
/** Emit SESSION_STARTED when a new session is created and initialising. */
export function emitSessionStarted(bus, ctx, data) {
    bus.emit('session', sessionEvent('SESSION_STARTED', data, ctx));
}
/** Emit SESSION_LOADING when an existing session is being loaded from disk. */
export function emitSessionLoading(bus, ctx, data) {
    bus.emit('session', sessionEvent('SESSION_LOADING', data, ctx));
}
/** Emit SESSION_RESUMED when a previously saved session is being resumed. */
export function emitSessionResumed(bus, ctx, data) {
    bus.emit('session', sessionEvent('SESSION_RESUMED', data, ctx));
}
/** Emit SESSION_REPAIRING when session state is being repaired after a detected inconsistency. */
export function emitSessionRepairing(bus, ctx, data) {
    bus.emit('session', sessionEvent('SESSION_REPAIRING', data, ctx));
}
/** Emit SESSION_RECONCILING when context messages are being reconciled with stored state. */
export function emitSessionReconciling(bus, ctx, data) {
    bus.emit('session', sessionEvent('SESSION_RECONCILING', data, ctx));
}
/** Emit SESSION_READY when session is fully loaded and ready for input. */
export function emitSessionReady(bus, ctx, data) {
    bus.emit('session', sessionEvent('SESSION_READY', data, ctx));
}
/** Emit SESSION_RECOVERY_FAILED when session recovery has failed unrecoverably. */
export function emitSessionRecoveryFailed(bus, ctx, data) {
    bus.emit('session', sessionEvent('SESSION_RECOVERY_FAILED', data, ctx));
}
