using DigitalData.EmailProfiler.Application.EmailProfiles.Commands; using FluentValidation; namespace DigitalData.EmailProfiler.Application.EmailProfiles.Validators; /// /// Validator for CreateEmailProfileCommand. /// public class CreateEmailProfileCommandValidator : AbstractValidator { public CreateEmailProfileCommandValidator() { RuleFor(x => x.ProfileName) .NotEmpty().WithMessage("Profile name is required") .MaximumLength(100).WithMessage("Profile name must not exceed 100 characters"); RuleFor(x => x.EmailAccountId) .GreaterThan(0).WithMessage("Email account ID must be greater than 0"); RuleFor(x => x.PollIntervalMinutes) .GreaterThanOrEqualTo(1).WithMessage("Poll interval must be at least 1 minute") .LessThanOrEqualTo(1440).WithMessage("Poll interval must not exceed 1440 minutes (24 hours)"); RuleFor(x => x.ValidationSql) .MaximumLength(1000).WithMessage("Validation SQL must not exceed 1000 characters") .When(x => !string.IsNullOrEmpty(x.ValidationSql)); } }