using FluentValidation; namespace Azaion.Common.Requests; public class UpdateDetectionClassRequest { public string? Name { get; set; } public string? ShortName { get; set; } public string? Color { get; set; } public double? MaxSizeM { get; set; } public string? PhotoMode { get; set; } } public class UpdateDetectionClassValidator : AbstractValidator { public UpdateDetectionClassValidator() { RuleFor(r => r.Name!).NotEmpty().MaximumLength(120).When(r => r.Name != null); RuleFor(r => r.ShortName!).NotEmpty().MaximumLength(20).When(r => r.ShortName != null); RuleFor(r => r.Color!).NotEmpty().MaximumLength(20).When(r => r.Color != null); RuleFor(r => r.MaxSizeM!.Value).GreaterThan(0).When(r => r.MaxSizeM != null); RuleFor(r => r.PhotoMode!).MaximumLength(20).When(r => r.PhotoMode != null); } }