package com.correx.core.artifacts.kind

interface ArtifactKindRegistry {
    fun register(kind: ArtifactKind)
    fun get(id: String): ArtifactKind?
    fun list(): Collection<ArtifactKind>
}

class DefaultArtifactKindRegistry : ArtifactKindRegistry {
    private val kinds: MutableMap<String, ArtifactKind> = mutableMapOf()

    init {
        register(FileWrittenKind)
        register(ProcessResultKind)
    }

    override fun register(kind: ArtifactKind) {
        kinds[kind.id] = kind
    }

    override fun get(id: String): ArtifactKind? = kinds[id]

    override fun list(): Collection<ArtifactKind> = kinds.values.toList()
}
