class_name ItemDetailsUI extends HBoxContainer

@export var icon_image: TextureRect
@export var description_label: Label

var _default_icon: Texture2D
var _default_description: String

func _ready() -> void:
    _default_icon = icon_image.texture
    _default_description = description_label.text

func _set_default():
    icon_image.texture = _default_icon
    description_label.text = _default_description

func _on_updated(_item: Option):
    if _item.is_some():
        var item: Item = _item.unwrap()
        icon_image.texture = item.icon
        description_label.text = item.description
    else:
        _set_default()
