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

/** One file-path reference from a brief and whether it grounds to an existing workspace entry. */
@Serializable
data class GroundingReference(
    val reference: String,
    val grounded: Boolean,
)

/**
 * Environment observation (invariant #9): the workspace-relative file paths a stage's brief
 * referenced, each checked for existence at the moment the stage produced its artifact. Replay
 * reads these recorded facts and never re-probes the filesystem. A reference that does not
 * ground is a hallucinated path — the failure analysts share with planners — and fails the
 * stage so the model re-grounds (role-reliability §3 entity grounding).
 */
@Serializable
@SerialName("BriefGroundingChecked")
data class BriefGroundingCheckedEvent(
    val sessionId: SessionId,
    val stageId: StageId,
    val artifactId: String,
    val references: List<GroundingReference>,
) : EventPayload
