package com.correx.core.kernel.orchestration

import com.correx.core.artifacts.kind.ContractAssertion
import java.nio.file.Path

/**
 * Verdict for one [ContractAssertion]. [skipped] marks an assertion this evaluator does not handle
 * — currently the `COMPILER` ones, which are covered by the static-analysis command gate (a real
 * `tsc`/`kotlinc` run), not re-implemented here. A skipped assertion is recorded but never fails a
 * stage.
 */
data class ContractAssertionVerdict(
    val passed: Boolean,
    val evidence: String,
    val skipped: Boolean = false,
)

/**
 * Seam for evaluating a Gate 2 contract assertion against files in the workspace (design §1). Like
 * [StaticAnalysisRunner], the filesystem-touching implementation lives in infrastructure and is
 * injected, so the deterministic core never reads files itself and the gate stays unit-testable with
 * a fake.
 *
 * The orchestrator records every verdict in a
 * [com.correx.core.events.events.ContractGateEvaluatedEvent] (invariant #9 environment observation)
 * — replay reads the recorded facts and never re-inspects the filesystem.
 */
fun interface ContractAssertionEvaluator {
    suspend fun evaluate(workspaceRoot: Path, assertion: ContractAssertion): ContractAssertionVerdict
}
