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