using FluentValidation;

public class RegisterPatientRequestValidator : AbstractValidator<RegisterPatientRequest>
{
    public RegisterPatientRequestValidator()
    {
        RuleFor(x => x.FirstName).NotEmpty().MaximumLength(100);
        RuleFor(x => x.LastName).NotEmpty().MaximumLength(100);
        RuleFor(x => x.Gender).NotEmpty().MaximumLength(10);
        RuleFor(x => x.DateOfBirth).NotEmpty()
            .LessThanOrEqualTo(DateOnly.FromDateTime(DateTime.UtcNow))
            .WithMessage("Date of birth cannot be in the future.");
        RuleFor(x => x.BloodType).IsInEnum()
            .When(x => x.BloodType is not null);
        RuleFor(x => x.EmergencyContactName).MaximumLength(200)
            .When(x => x.EmergencyContactName is not null);
        RuleFor(x => x.EmergencyContactPhone).MaximumLength(20)
            .When(x => x.EmergencyContactPhone is not null);
    }
}