package ru.dbotthepony.kstarbound.defs.monster

import com.google.common.collect.ImmutableList
import com.google.common.collect.ImmutableMap
import com.google.common.collect.ImmutableSet
import ru.dbotthepony.kommons.util.Either
import ru.dbotthepony.kstarbound.Registry
import ru.dbotthepony.kstarbound.defs.ActorMovementParameters
import ru.dbotthepony.kstarbound.defs.AssetReference
import ru.dbotthepony.kstarbound.defs.IScriptable
import ru.dbotthepony.kstarbound.defs.IThingWithDescription
import ru.dbotthepony.kstarbound.defs.animation.AnimationDefinition
import ru.dbotthepony.kstarbound.defs.item.TreasurePoolDefinition
import ru.dbotthepony.kstarbound.json.builder.JsonFactory
import ru.dbotthepony.kstarbound.json.builder.JsonFlat

@JsonFactory
data class MonsterTypeDefinition(
	val type: String,
	@JsonFlat
	val desc: IThingWithDescription,
	val categories: ImmutableSet<String> = ImmutableSet.of(),
	val parts: ImmutableSet<String> = ImmutableSet.of(),
	val animation: AssetReference<AnimationDefinition>,
	// [ { "default" : "poptopTreasure", "bow" : "poptopHunting" } ],
	// "dropPools" : [ "smallRobotTreasure" ],
	val dropPools: Either<ImmutableList<ImmutableMap<String, Registry.Ref<TreasurePoolDefinition>>>, ImmutableList<Registry.Ref<TreasurePoolDefinition>>>,
	val baseParameters: BaseParameters
) : IThingWithDescription by desc {
	@JsonFactory
	data class BaseParameters(
		val movementSettings: ActorMovementParameters? = null,
		@JsonFlat
		val script: IScriptable,
	) : IScriptable by script
}
