package ru.dbotthepony.kstarbound.defs.tile

import ru.dbotthepony.kstarbound.defs.image.SpriteReference
import ru.dbotthepony.kstarbound.json.builder.JsonFactory
import ru.dbotthepony.kstarbound.json.builder.JsonNotNull

@JsonFactory
data class RenderParameters(
	@JsonNotNull
	val texture: SpriteReference?,
	val variants: Int = 0,
	val multiColored: Boolean = false,
	val occludesBelow: Boolean = false,
	val lightTransparent: Boolean = false,
	val zLevel: Long = 0,
) {
	init {
		if (texture != null)
			checkNotNull(texture.imagePath.value) { "Tile render parameters are stateless, but provided image is a pattern: ${texture.raw}" }
	}

	companion object {
		val META = RenderParameters(null, zLevel = 0, lightTransparent = true)
	}
}
