using Intrepid.ObjectPooling;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace Intrepid.Gameplay.Entities.Player.PDA.UI
{
    public class PDASectionReferenceUI : PoolableGameObject
    {
        [SerializeField] private PDASectionTag sectionTag;
        [SerializeField] private TextMeshProUGUI textMesh;
        [SerializeField] private Image image;
        [SerializeField] private LayoutElement layoutElement;
        
        public PDASectionTag SectionTag => sectionTag;
        public string Title { get; private set; }

        public void Setup(PDASectionReferenceDTO sectionReference)
        {
            layoutElement.minHeight = sectionReference.Height;
            image.color = sectionReference.Color;
            sectionTag = sectionReference.SectionTag;
            Title = sectionReference.Title;
            textMesh.text = Title;
        }
    }

    public class PDASectionReferenceDTO
    {
        public float Height { get; set; }
        public PDASectionTag SectionTag { get; set; }
        public string Title { get; set; }
        
        public Color Color { get; set; }
    }
}