using System.Text;
using Schema;
using UnityEngine;
using VOID.Generic.Objects.Unit;

namespace VOID.Generic.AI.Schema.Conditionals
{
    [DarkIcon("Conditionals/d_IsNull")]
    [LightIcon("Conditionals/IsNull")]
    [Category(SchemaCategory.ThisUnit)]
    public class IsUnitObjectSchema : Conditional
    {
        public override bool Evaluate(object nodeMemory, SchemaAgent agent)
        {
            return agent is UnitObjectSchemaAgent unitAgent && unitAgent.unit;
        }

        public override GUIContent GetConditionalContent()
        {
            var sb = new StringBuilder();
            if (invert) sb.Append("<color=red>NOT</color> ");
            sb.Append($"If this is <color=red>{nameof(UnitObject)}</color>'s schema");
            return new GUIContent(sb.ToString());
        }
    }
}