class JobAssertions {

    public Map<String, String> validateImage(Image image) {
        // As class-level constraints are evaluated after field-level constraints we have to check for null value here.
        if (image == null) {
            return Collections.emptyMap();
        }

        Map<String, String> violations = new HashMap<>();
        if (!IMAGE_NAME_PATTERN.matcher(image.getName()).matches()) {
            violations.put("name", "image name is not valid");
        }

        boolean validDigest = !Strings.isNullOrEmpty(image.getDigest()) && IMAGE_DIGEST_PATTERN.matcher(image.getDigest()).matches();
        boolean validTag = !Strings.isNullOrEmpty(image.getTag()) && IMAGE_TAG_PATTERN.matcher(image.getTag()).matches();

        if (!validDigest && !validTag) {
            violations.put("noValidImageDigestOrTag", "must specify a valid digest or tag");
        }

        return violations;
    }

    public  JobAssertions(JobConfiguration configuration,
                         Function<String, ResourceDimension> maxContainerSizeResolver);

}