using FluentValidation;

namespace Baya.Application.Features.Verification.Commands.SubmitCredentialDetails;

public sealed class SubmitCredentialDetailsCommandValidator : AbstractValidator<SubmitCredentialDetailsCommand>
{
    public SubmitCredentialDetailsCommandValidator()
    {
        RuleFor(x => x.InoNumber).NotEmpty().MaximumLength(50);
        RuleFor(x => x.LicenseNumber).MaximumLength(50);
        RuleFor(x => x.IssuingAuthority).MaximumLength(150);
        RuleFor(x => x.HolderName).MaximumLength(200);
        RuleFor(x => x.Specialties)
            .Must(s => s is null || s.All(c => !string.IsNullOrWhiteSpace(c) && c.Length <= 50))
            .WithMessage("Each specialty must be a non-empty code up to 50 characters.");
    }
}
