using UnityEngine;
using UnityEngine.UIElements;

namespace VOID.UserInterface.Game.Tooltip
{
    public class DetailsElement
    {
        public DetailsElement(VisualElement container, Sprite icon, string[] text)
        {
            var detailsElement = new VisualElement();
            detailsElement.AddToClassList("details-element");
            detailsElement.pickingMode = PickingMode.Ignore;
            container.Add(detailsElement);
            
            var detailsIcon = new VisualElement();
            detailsIcon.AddToClassList("details-icon");
            detailsIcon.style.backgroundImage = new StyleBackground(icon);
            detailsIcon.pickingMode = PickingMode.Ignore;
            detailsElement.Add(detailsIcon);
            
            var detailsLabel = new Label();
            detailsLabel.AddToClassList("details-label");
            detailsLabel.text = string.Join("<br>", text);
            detailsLabel.pickingMode = PickingMode.Ignore;
            detailsElement.Add(detailsLabel);
        }
    }
}