package org.raddatz.familienarchiv.document.annotation;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

import java.util.HashSet;
import java.util.List;

public class UniquePointsValidator implements ConstraintValidator<UniquePoints, List<List<Double>>> {

    @Override
    public boolean isValid(List<List<Double>> polygon, ConstraintValidatorContext context) {
        if (polygon == null) return true;
        return new HashSet<>(polygon).size() == polygon.size();
    }
}
