package com.correx.core.kernel.execution

import com.correx.core.approvals.model.DomainApprovalRequest
import com.correx.core.artifacts.model.Artifact
import com.correx.core.validation.model.ValidationReport

sealed interface StageOutcome {
    data class Success(val artifact: Artifact) : StageOutcome
    /**
     * @param retryable set by the validator based on failure type; the orchestrator must read this
     *   and never override it.
     *   Structural errors (e.g. invalid graph topology) are not retryable. Transient errors may be.
     */
    data class ValidationFailure(val report: ValidationReport, val retryable: Boolean) : StageOutcome
    data class InferenceFailure(val reason: String, val retryable: Boolean) : StageOutcome
    data class ApprovalRequired(val request: DomainApprovalRequest) : StageOutcome
    data object Cancelled : StageOutcome
}
