package com.correx.core.events.events

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

/**
 * Emitted when the model's restatement of the analyst brief diverges beyond the acceptance
 * threshold: it dropped requirements or hallucinated file references. Recorded as a domain
 * signal for audit and narration. The gate then fails the stage (retryable) so the pipeline
 * cannot reach plan generation on a misread brief.
 *
 * Determinism note: this is NOT an environment observation (invariant #9). The diff is a pure
 * function of two already-recorded artifacts (the analysis brief and the brief_echo), so it is
 * deterministically recomputable on replay without re-emitting this event. The event is emitted
 * only on mismatch, as a domain signal.
 */
@Serializable
@SerialName("BriefEchoMismatch")
data class BriefEchoMismatchEvent(
    val sessionId: SessionId,
    val stageId: StageId,
    val uncoveredRequirements: List<String>,
    val hallucinatedFiles: List<String>,
    val hallucinatedSymbols: List<String>,
) : EventPayload
