Files

16 lines
606 B
C#

using FluentValidation;
using VigilCare.ClinicalContracts.Sync;
public class GatewayHeartbeatRequestValidator : AbstractValidator<GatewayHeartbeatRequest>
{
private static readonly string[] AllowedStatuses = ["ONLINE", "DEGRADED", "OFFLINE"];
public GatewayHeartbeatRequestValidator()
{
RuleFor(x => x.Status).NotEmpty()
.Must(s => AllowedStatuses.Contains(s.ToUpperInvariant()))
.WithMessage("Status must be ONLINE, DEGRADED, or OFFLINE.");
RuleFor(x => x.BufferDepth).GreaterThanOrEqualTo(0);
RuleFor(x => x.ReportedAtUtc).NotEmpty();
}
}