package com.correx.core.events.events

import com.correx.core.events.types.SessionId
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
 * The freeform user request that kicked off a workflow run (e.g. "add an auth layer to the
 * account service"). Recorded once at session start so it flows into the decision journal and
 * is pinned into every stage's context — the input channel for intent-driven pipelines.
 * Optional: fixed-task workflows (e.g. healthcheck) start without one.
 */
@Serializable
@SerialName("InitialIntent")
data class InitialIntentEvent(
    val sessionId: SessionId,
    val intent: String,
) : EventPayload

/**
 * A short, human-readable title for the session (e.g. "Add auth to account service"), derived
 * once from the initial intent by the Talkie model. Recorded as an event (invariant #9) so the
 * nondeterministic name is generated a single time and replays identically — the TUI shows this
 * instead of the opaque workflow id. Non-authoritative display metadata; nothing in the core
 * decision path reads it.
 */
@Serializable
@SerialName("SessionNamed")
data class SessionNamedEvent(
    val sessionId: SessionId,
    val name: String,
    val timestampMs: Long,
) : EventPayload
