package ru.dbotthepony.mc.otm.menu.input

import ru.dbotthepony.mc.otm.core.GetterSetter
import ru.dbotthepony.mc.otm.menu.MatteryMenu
import kotlin.reflect.KMutableProperty0

class StringInputWithFeedback(menu: MatteryMenu) : AbstractPlayerInputWithFeedback<String>() {
	override val input = menu.stringInput { consumer?.invoke(it.replace('\u0000', ' ')) }
	override val value by menu.mSynchronizer.computedString { supplier?.invoke() ?: "" }

	constructor(menu: MatteryMenu, state: KMutableProperty0<String>) : this(menu) {
		with(state)
	}

	constructor(menu: MatteryMenu, state: GetterSetter<String>) : this(menu) {
		with(state)
	}
}
