package io.gitlab.jfronny.scripts import java.util.* import java.util.stream.Collectors enum class VersionType(val displayName: String, val curseforgeName: String, val modrinthName: String, val semanticName: String, val shorthand: String): Comparable { ALPHA("Alpha", "alpha", "alpha", "alpha", "a"), BETA("Beta", "beta", "beta", "beta", "b"), RELEASE_CANDIDATE("Release Candidate", "beta", "beta", "rc", "rc"), RELEASE("Release", "release", "release", "release", "v"); companion object { private val byShorthand = Arrays.stream(VersionType.values()).collect(Collectors.toUnmodifiableMap({ it.shorthand }, { it })) private val byName = Arrays.stream(VersionType.values()).collect(Collectors.toUnmodifiableMap({ it.semanticName }, { it })) fun byShorthand(shorthand: String): VersionType? = byShorthand[shorthand] fun byName(name: String): VersionType? = byName[name] } }