package ru.dbotthepony.kstarbound.defs

import ru.dbotthepony.kstarbound.json.builder.JsonFactory

@JsonFactory
data class JumpProfile(
	val jumpSpeed: Double? = null,
	val jumpControlForce: Double? = null,
	val jumpInitialPercentage: Double? = null,
	val jumpHoldTime: Double? = null,
	val jumpTotalHoldTime: Double? = null,
	val multiJump: Boolean? = null,
	val reJumpDelay: Double? = null,
	val autoJump: Boolean? = null,
	val collisionCancelled: Boolean? = null,
) {
	fun merge(other: JumpProfile): JumpProfile {
		return JumpProfile(
			jumpSpeed = other.jumpSpeed ?: jumpSpeed,
			jumpControlForce = other.jumpControlForce ?: jumpControlForce,
			jumpInitialPercentage = other.jumpInitialPercentage ?: jumpInitialPercentage,
			jumpHoldTime = other.jumpHoldTime ?: jumpHoldTime,
			jumpTotalHoldTime = other.jumpTotalHoldTime ?: jumpTotalHoldTime,
			multiJump = other.multiJump ?: multiJump,
			reJumpDelay = other.reJumpDelay ?: reJumpDelay,
			autoJump = other.autoJump ?: autoJump,
			collisionCancelled = other.collisionCancelled ?: collisionCancelled,
		)
	}

	companion object {
		val EMPTY = JumpProfile()
	}
}
