using FluentValidation;

using Monitoring.Interfaces;

namespace Monitoring.Extensions;

public static class TableStateExtensions
{
	public static void AddTableRules<T>(AbstractValidator<T> validator)
		where T : ITableState
	{
		_ = validator.RuleFor(x => x.Take).GreaterThan(1).When(x => x.Take.HasValue);
		_ = validator.RuleFor(x => x.Skip).GreaterThanOrEqualTo(0).When(x => x.Skip.HasValue);
	}
}
