using Sirenix.OdinInspector.Editor.Validation;
using Sirenix.Utilities;
using VOID.Editor.AttributeValidator;
using VOID.Generic.DynamicValue;

[assembly: RegisterValidator(typeof(DynamicFormulaValidator))]

namespace VOID.Editor.AttributeValidator
{
    public class DynamicFormulaValidator : ValueValidator<DynamicFormula>
    {
        protected override void Validate(ValidationResult result)
        {
            if (Value == null) return;

            ValidatePresent(result);
        }

        private void ValidatePresent(ValidationResult result)
        {
            if (!Value.dynamicValue.IsNullOrWhitespace()) return;

            result.AddError("Math formula is empty!");
        }
    }
}