using System.ComponentModel.DataAnnotations;

namespace SharedKernel.Attributes
{
    public class MustBeTrueAttribute : ValidationAttribute
    {
        protected override ValidationResult? IsValid(object? value, ValidationContext validationContext)
        {
            if (value is bool boolValue && boolValue)
            {
                return ValidationResult.Success;
            }

            return new ValidationResult(ErrorMessage ?? "값은 `true` 여야 합니다.");
        }
    }
}