using FluentValidation;

public class IngestObservationRequestValidator : AbstractValidator<IngestObservationRequest>
{
    public IngestObservationRequestValidator()
    {
        RuleFor(x => x.ObservationCode).NotEmpty().MaximumLength(50);
        RuleFor(x => x.Unit).NotEmpty().MaximumLength(20);
        RuleFor(x => x.RecordedAt)
            .LessThanOrEqualTo(DateTimeOffset.UtcNow.AddMinutes(5))
            .WithMessage("RecordedAt cannot be more than 5 minutes in the future.");
    }
}
