// Copyright (c) The Geekeey Authors // SPDX-License-Identifier: EUPL-1.2 namespace Geekeey.Request.Validation; /// /// Represents a builder for defining a validation rule for a specific property of a type. /// /// The type of the object to be validated. /// The type of the property to validate. public interface IPropertyRuleBuilder { /// /// Defines a validation rule that must be met for the property to be considered valid. /// /// The predicate function that determines if the property value is valid. /// The error message to be returned if the validation fails. /// The current rule builder instance for method chaining. IPropertyRuleBuilder Must(Func predicate, string message); /// /// Sets the validator to be used for validating the property value. /// /// The validator instance to use for validation. /// The current rule builder instance for method chaining. IPropertyRuleBuilder SetValidator(IValidator validator); /// /// Sets the validator to be used for validating the property value. /// /// The type of the validator to use for validation. /// The current rule builder instance for method chaining. IPropertyRuleBuilder SetValidator() where TValidator : IValidator; /// /// Sets the error code for the validation rule. /// /// The error code to be associated with the validation rule. /// The current rule builder instance for method chaining. IPropertyRuleBuilder WithCode(string code); /// /// Transforms the property path reported by the validation rule. /// /// The function used to transform the rule property path. /// The current rule builder instance for method chaining. IPropertyRuleBuilder WithPropertyPath(Func transform); /// /// Sets the severity of the validation rule. /// /// The severity level of the validation rule. /// The current rule builder instance for method chaining. IPropertyRuleBuilder WithSeverity(Severity severity); }