using InfinityPBR.ModularCharacterHelper;
using Sirenix.OdinInspector.Editor.Validation;
using VOID.Editor.AttributeValidator;

[assembly: RegisterValidator(typeof(ModularCharacterValidator))]

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

        private void ValidateBoneRoot(ValidationResult result)
        {
            if (Value.targetRootBone) return;
            
            result.AddError($"<b>{nameof(Value.targetRootBone)}</b> is required!");
        }
    }
}