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 prior decision/ADR surfaced as semantically near a new architect decision.
 * [source] is the L3 entry's turnId (or a decision id) the line came from; [score] is the
 * similarity of the prior decision to the new one.
 */
@Serializable
data class RelatedDecision(
    val summary: String,
    val score: Double,
    val source: String,
)

/**
 * Display-only architect contradiction surfacing (BACKLOG §B-§4). Lists prior decisions
 * semantically near the new one so the operator can spot a reversal. Non-blocking: this event
 * only surfaces similarity candidates for an operator to eyeball — it never halts or fails a
 * stage, and there is no LLM judge.
 */
@Serializable
@SerialName("PossibleContradictionFlagged")
data class PossibleContradictionFlaggedEvent(
    val sessionId: SessionId,
    val stageId: StageId,
    val decisionSummary: String,
    val related: List<RelatedDecision>,
) : EventPayload
