using FluentValidation;

namespace Forwarder.Features.AssetMapManagement.CreateAssetMap;

public class CreateAssetMapValidator : AbstractValidator<CreateAssetMapRequest>
{
	public CreateAssetMapValidator()
	{
		RuleFor(x => x.Abonent)
			.NotNull()
			.NotEmpty()
			.Matches(@"^\d{8}$").WithMessage("Abonent must be 8 digits.");

		RuleFor(x => x.AssetId)
			.NotEmpty().When(x => x.AssetId.HasValue);
	}
}
