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 IsPatrolDefined : Conditional
    {
        public override bool Evaluate(object nodeMemory, SchemaAgent agent)
        {
            return (agent as UnitObjectSchemaAgent)?.unitAI.patrol.Count > 1;
        }

        public override GUIContent GetConditionalContent()
        {
            var sb = new StringBuilder();
            if (invert) sb.Append("<color=red>NOT</color> ");
            sb.Append($"<color=red>{nameof(UnitObjectSenses)}</color> has at least two <color=red>patrol</color> points");
            return new GUIContent(sb.ToString());
        }
    }
}