using FluentValidation;

using Monitoring.Core.Domain.AssetManagement;

namespace Monitoring.Features.ResponsiblePersons.CreateResponsiblePerson;

public class CreateResponsiblePersonValidator : AbstractValidator<CreateResponsiblePersonRequest>
{
	public CreateResponsiblePersonValidator()
	{
		_ = RuleFor(x => x.AssetId).NotEmpty();

		_ = RuleFor(x => x.Name).NotEmpty()
			.MinimumLength(AssetName.MinLength)
			.MaximumLength(AssetName.MaxLength);
		_ = RuleFor(x => x.Key)
			.MaximumLength(AssetName.MaxLength);
		_ = RuleFor(x => x.Phone1)
			.MaximumLength(AssetName.MaxLength);
		_ = RuleFor(x => x.Phone2)
			.MaximumLength(AssetName.MaxLength);
		_ = RuleFor(x => x.Note)
			.MaximumLength(AssetDescription.MaxLength);
	}
}
