using FluentValidation;

using Microsoft.EntityFrameworkCore;

using Monitoring.Core.Domain.Primitives;

namespace Monitoring.Features.Areas.UpdateArea;

public class UpdateAreaValidator : AbstractValidator<UpdateAreaRequest>
{
	public UpdateAreaValidator()
	{
		_ = RuleFor(x => x.Index)
			.GreaterThan(0).LessThanOrEqualTo(99);

		_ = RuleFor(x => x.Name)
			.NotEmpty()
			.MinimumLength(AreaName.MinLength)
			.MaximumLength(AreaName.MaxLength);

		_ = RuleFor(x => x.Description)
			.NotEmpty()
			.MinimumLength(AreaDescription.MinLength)
			.MaximumLength(AreaDescription.MaxLength);
	}
}
