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

fun interface FieldGetter<V> {
	fun invoke(field: FieldAccess<V>): V
}

fun interface FloatFieldGetter : FieldGetter<Float> {
	fun invoke(field: FloatFieldAccess): Float

	@Deprecated("Use type specific invoke")
	override fun invoke(field: FieldAccess<Float>): Float {
		return invoke(field as FloatFieldAccess)
	}
}

fun interface DoubleFieldGetter : FieldGetter<Double> {
	fun invoke(field: DoubleFieldAccess): Double

	@Deprecated("Use type specific invoke")
	override fun invoke(field: FieldAccess<Double>): Double {
		return invoke(field as DoubleFieldAccess)
	}
}

fun interface IntFieldGetter : FieldGetter<Int> {
	fun invoke(field: IntFieldAccess): Int

	@Deprecated("Use type specific invoke")
	override fun invoke(field: FieldAccess<Int>): Int {
		return invoke(field as IntFieldAccess)
	}
}

fun interface LongFieldGetter : FieldGetter<Long> {
	fun invoke(field: LongFieldAccess): Long

	@Deprecated("Use type specific invoke")
	override fun invoke(field: FieldAccess<Long>): Long {
		return invoke(field as LongFieldAccess)
	}
}

fun interface BooleanFieldGetter : FieldGetter<Boolean> {
	fun invoke(field: BooleanFieldAccess): Boolean

	@Deprecated("Use type specific invoke")
	override fun invoke(field: FieldAccess<Boolean>): Boolean {
		return invoke(field as BooleanFieldAccess)
	}
}
