package kz.konturai.parser.validator;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import java.util.Arrays;
import java.util.List;

public class ClientTypeValidator implements ConstraintValidator<ValidClientType, String> {

    private static final List<String> VALID_CLIENT_TYPES = Arrays.asList(
            "B2B клиенты",
            "B2C клиенты",
            "Частные лица",
            "Корпорации",
            "Малый бизнес");

    @Override
    public void initialize(ValidClientType constraintAnnotation) {
    }

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