#region ========================================================================= USING ===================================================================================== using Lumina.Presentation.Web.Common.Primitives; using System; #endregion namespace Lumina.Presentation.Web.Common.Validation; /// /// Provides a fluent API for building validation rules for a specific type. /// /// The type of the instance being validated. /// The type of the specific property on the instance that the rule applies to. public interface IRuleBuilder { /// /// Specifies a condition that the property must satisfy to be considered valid. /// /// A function to test the property value. /// The current instance for method chaining. IRuleBuilder Must(Func predicate); /// /// Specifies a condition that both the request instance and the property value must satisfy to be considered valid. /// /// A function to test the request instance together with the property value. /// The current instance for method chaining. IRuleBuilder Must(Func predicate); /// /// Specifies a condition that must be met for the validation rule to be executed. /// /// A function evaluating the request instance. /// The current instance for method chaining. IRuleBuilder When(Func condition); /// /// Specifies a custom object to be returned when the validation fails. /// /// The specific error to return upon failure. /// The current instance for method chaining. IRuleBuilder WithError(Error error); /// /// Defines nested validation rules for the complex property being validated. /// /// An action used to configure the inline validator for the property. /// The current instance for method chaining. IRuleBuilder ChildRules(Action> configure); }