using TMPro;
using UnityEngine;

namespace Scrips
{
    public class Patient : AI_Agent
    {
        [SerializeField] TextMeshProUGUI _currentStatePrint;
        [SerializeField] private Material m_Healthy;
        [SerializeField] private Material m_Sick;
        

        protected override void Start()
        {
            base.Start();
            var s1 = new SubGoal("IsWaiting", 1, true);
            goals.Add(s1, 1);

            var s2 = new SubGoal("IsTreated", 1, true);
            goals.Add(s2, 3);

            var s3 = new SubGoal("IsHome", 1, true);
            goals.Add(s3, 5);
        }
        
        private void Update()
        {
            if (_currentStatePrint != null && planner != null)
            {
                _currentStatePrint.text = "Patient 1 Action: " + currentAction.actionName + "\n";
            }
            
            if( agentWorldStates.GetStates().ContainsKey("IsHealthy") && 
               agentWorldStates.GetStates()["IsHealthy"] > 0)
            {
                GetComponent<Renderer>().material = m_Healthy;
            }
        }
    }
}