package com.correx.core.transitions.conditions

import com.correx.core.events.types.ArtifactId
import com.correx.core.events.types.ArtifactLifecyclePhase
import com.correx.core.transitions.evaluation.EvaluationContext
import com.correx.core.transitions.graph.TransitionCondition

data class ArtifactPresent(val artifactId: ArtifactId) : TransitionCondition {
    override fun evaluate(context: EvaluationContext) =
        context.artifacts[artifactId] != null
}

data class ArtifactAbsent(val artifactId: ArtifactId) : TransitionCondition {
    override fun evaluate(context: EvaluationContext) =
        context.artifacts[artifactId] == null
}

data class ArtifactValidated(val artifactId: ArtifactId) : TransitionCondition {
    override fun evaluate(context: EvaluationContext) =
        context.artifacts[artifactId]?.phase == ArtifactLifecyclePhase.VALIDATED
}
