package ru.dbotthepony.mc.otm.network.synchronizer

fun interface FieldSetter<V> {
	fun invoke(value: V, access: FieldAccess<V>, setByRemote: Boolean)
}

fun interface FloatFieldSetter : FieldSetter<Float> {
	fun invoke(value: Float, access: FloatFieldAccess, setByRemote: Boolean)

	@Deprecated("Use type specific invoke")
	override fun invoke(value: Float, access: FieldAccess<Float>, setByRemote: Boolean) {
		invoke(value, access as FloatFieldAccess, setByRemote)
	}
}

fun interface DoubleFieldSetter : FieldSetter<Double> {
	fun invoke(value: Double, access: DoubleFieldAccess, setByRemote: Boolean)

	@Deprecated("Use type specific invoke")
	override fun invoke(value: Double, access: FieldAccess<Double>, setByRemote: Boolean) {
		invoke(value, access as DoubleFieldAccess, setByRemote)
	}
}

fun interface IntFieldSetter : FieldSetter<Int> {
	fun invoke(value: Int, access: IntFieldAccess, setByRemote: Boolean)

	@Deprecated("Use type specific invoke")
	override fun invoke(value: Int, access: FieldAccess<Int>, setByRemote: Boolean) {
		invoke(value, access as IntFieldAccess, setByRemote)
	}
}

fun interface LongFieldSetter : FieldSetter<Long> {
	fun invoke(value: Long, access: LongFieldAccess, setByRemote: Boolean)

	@Deprecated("Use type specific invoke")
	override fun invoke(value: Long, access: FieldAccess<Long>, setByRemote: Boolean) {
		invoke(value, access as LongFieldAccess, setByRemote)
	}
}

fun interface BooleanFieldSetter : FieldSetter<Boolean> {
	fun invoke(value: Boolean, access: BooleanFieldAccess, setByRemote: Boolean)

	@Deprecated("Use type specific invoke")
	override fun invoke(value: Boolean, access: FieldAccess<Boolean>, setByRemote: Boolean) {
		invoke(value, access as BooleanFieldAccess, setByRemote)
	}
}
