package ru.dbotthepony.kstarbound.defs.world

import com.google.gson.reflect.TypeToken
import ru.dbotthepony.kstarbound.json.builder.DispatchingAdapter
import ru.dbotthepony.kstarbound.json.builder.IStringSerializable

enum class BiomePlacementDistributionType(
	override val jsonName: String,
	val def: TypeToken<out BiomePlaceablesDefinition.DistributionData>,
) : IStringSerializable {
	RANDOM("random",TypeToken.get(BiomePlaceablesDefinition.RandomDistribution::class.java)),
	PERIODIC("periodic", TypeToken.get(BiomePlaceablesDefinition.PeriodicDistribution::class.java));

	override fun match(name: String): Boolean {
		return name.lowercase() == jsonName
	}

	companion object {
		val DEFINITION_ADAPTER = DispatchingAdapter("type", { type }, { def }, entries)
	}
}