package ru.dbotthepony.mc.otm.client.screen.decorative

import net.minecraft.network.chat.Component
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.Dock
import ru.dbotthepony.mc.otm.client.screen.panels.DockProperty
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
import ru.dbotthepony.mc.otm.client.screen.panels.button.CheckBoxLabelInputPanel
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
import ru.dbotthepony.mc.otm.client.screen.panels.input.NetworkedStringInputPanel
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.menu.decorative.HoloSignMenu

class HoloSignScreen(menu: HoloSignMenu, inventory: Inventory, title: Component) : MatteryScreen<HoloSignMenu>(menu, title) {
	override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
		val frame = FramePanel(this, null, 0f, 0f, 200f, 200f, getTitle())

		frame.makeCloseButton()
		frame.onClose { onClose() }

		val input = NetworkedStringInputPanel(this, frame, backend = menu.text)
		input.dock = Dock.FILL
		input.multiLine = true

		val lock = CheckBoxLabelInputPanel(this, frame, menu.locked, TranslatableComponent("otm.gui.lock_holo_screen"))
		lock.dock = Dock.BOTTOM
		lock.dockMargin = DockProperty(2f, 2f, 2f, 2f)
		lock.tooltips.add(TranslatableComponent("otm.gui.lock_holo_screen.tip"))

		makeDeviceControls(this, frame, redstoneConfig = menu.redstone)

		return frame
	}
}
