package kz.konturai.parser.validator;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import kz.konturai.parser.model.DetailLevel;

public class DetailLevelValidator implements ConstraintValidator<ValidDetailLevel, String> {

    @Override
    public void initialize(ValidDetailLevel constraintAnnotation) {
    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        if (value == null || value.trim().isEmpty()) {
            return true; // @NotBlank will handle null/empty
        }
        return DetailLevel.fromString(value) != null;
    }
}

