using Octopus.Simulator;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class LogicItemButton : MonoBehaviour
{
    [Header("UI References")]
    [SerializeField] private Image iconImage;
    [SerializeField] private TMP_Text nameText;
    [SerializeField] private Button button;

    [Header("Type Icons")]
    [SerializeField] private Sprite queueIcon;
    [SerializeField] private Sprite resourceIcon;
    [SerializeField] private Sprite componentIcon;

    // 타입→아이콘 매핑
    private Dictionary<LogicItemType, Sprite> IconMap;
    private void Awake()
    {
        IconMap = new Dictionary<LogicItemType, Sprite>()
        {
            { LogicItemType.Queue, queueIcon },
            { LogicItemType.Resource, resourceIcon },
            { LogicItemType.Component, componentIcon }
        };
    }

    /// <summary>
    /// 외부에서 이 버튼을 초기화할 때 호출
    /// </summary>
    public void Setup(ILogicItem item)
    {
        iconImage.sprite = IconMap[item.ItemType];
        nameText.text = item.Name;

        button.onClick.RemoveAllListeners();
        button.onClick.AddListener(OnClick);
    }

    private void OnClick()
    {
    }
}