using FluentValidation;
using Monitoring.Common.Validators;

namespace Monitoring.Features.Assets.GetAssetList;

public class GetAssetListValidator : AbstractValidator<GetAssetListRequest>
{
	public GetAssetListValidator()
	{
		_ = RuleFor(x => x).SetValidator(new TableStateValidator());
		_ = RuleFor(x => x.OrganizationId).NotEmpty().When(x => x.OrganizationId.HasValue);
		_ = RuleFor(x => x.GroupId).NotEmpty().When(x => x.GroupId.HasValue);
		_ = RuleFor(x => x.Search).NotEmpty().When(x => x.Search != null);
	}
}
