using FluentValidation;

public class CreateMedicationAdministrationRequestValidator
    : AbstractValidator<CreateMedicationAdministrationRequest>
{
    public CreateMedicationAdministrationRequestValidator()
    {
        RuleFor(x => x.DrugName).NotEmpty().MaximumLength(200);
        RuleFor(x => x.Dose).GreaterThan(0);
        RuleFor(x => x.DoseUnit).NotEmpty().MaximumLength(20);
        RuleFor(x => x.Route).NotEmpty().MaximumLength(50);
        RuleFor(x => x.AdministeredBy).NotEmpty().MaximumLength(100);
        RuleFor(x => x.AdministeredAt)
            .LessThanOrEqualTo(DateTimeOffset.UtcNow.AddMinutes(5))
            .When(x => x.AdministeredAt.HasValue)
            .WithMessage("AdministeredAt cannot be in the future.");
    }
}