using Set.Data;
using TMPro;
using UnityEngine;

namespace UI
{
    public class TraitDisplayInfo : MonoBehaviour
    {
        [SerializeField]
        private TMP_Text _traitName;

        [SerializeField]
        private TMP_Text _traitEmblemCount;

        public string DisplayName { get; }

        public TraitsEnum Trait { get; private set; }

        public void Initialize(TraitsEnum trait, string traitName, int traitCount)
        {
            _traitName.text = traitName;
            _traitEmblemCount.text = traitCount.ToString();
            Trait = trait;
        }

        public int GetEmblemCount()
        {
            int count;
            int.TryParse(_traitEmblemCount.text, out count);
            if(count != 0)
                Debug.Log($"Trait {Trait} has count {count}");
            return count;
        }
    }
}
