// Path: src/main/java/org/javiermf/features/exceptions/ObjectNotFoundException.java
// public class ObjectNotFoundException extends RuntimeException {
//     public ObjectNotFoundException(String productName) {
//         super(String.format("Object with id %s has not been found", productName));
//     }
// }
// 
// Path: src/main/java/org/javiermf/features/models/constraints/FeatureConstraint.java
// @Entity
// @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
// public abstract class FeatureConstraint {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.SEQUENCE)
//     Long id;
// 
//     @ManyToOne
//     Product forProduct;
// 
//     public abstract String getType();
// 
//     public abstract EvaluationResult evaluateConfiguration(EvaluationResult currentResult, ProductConfiguration configuration);
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public void setForProduct(Product forProduct) {
//         this.forProduct = forProduct;
//     }
// }


import com.fasterxml.jackson.annotation.JsonProperty;
import org.javiermf.features.exceptions.ObjectNotFoundException;
import org.javiermf.features.models.constraints.FeatureConstraint;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
    public static Product buildWithFeatures(String... featureNames) {
        Product product = new Product();
        for (String featureName : featureNames) {
            product.addFeature(Feature.withName(product, featureName));
        }

        return product;

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @JsonProperty("constraints")
    public Set<FeatureConstraint> getProductFeatureConstraints() {
        return productFeatureConstraints;
    }

    public Feature findProductFeatureByName(String featureName) {
        for (Feature feature : getProductFeatures()) {
            if (feature.name.equalsIgnoreCase(featureName)) {
                return feature;
            }
        }

// Path: src/main/java/org/javiermf/features/exceptions/ObjectNotFoundException.java
// public class ObjectNotFoundException extends RuntimeException {
//     public ObjectNotFoundException(String productName) {
//         super(String.format("Object with id %s has not been found", productName));
//     }
// }
// 
// Path: src/main/java/org/javiermf/features/models/constraints/FeatureConstraint.java
// @Entity
// @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
// public abstract class FeatureConstraint {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.SEQUENCE)
//     Long id;
// 
//     @ManyToOne
//     Product forProduct;
// 
//     public abstract String getType();
// 
//     public abstract EvaluationResult evaluateConfiguration(EvaluationResult currentResult, ProductConfiguration configuration);
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public void setForProduct(Product forProduct) {
//         this.forProduct = forProduct;
//     }
// }


// Path: src/main/java/org/javiermf/features/models/Product.java
import com.fasterxml.jackson.annotation.JsonProperty;
import org.javiermf.features.exceptions.ObjectNotFoundException;
import org.javiermf.features.models.constraints.FeatureConstraint;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

    public static Product buildWithFeatures(String... featureNames) {
        Product product = new Product();
        for (String featureName : featureNames) {
            product.addFeature(Feature.withName(product, featureName));
        }

        return product;

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @JsonProperty("constraints")
    public Set<FeatureConstraint> getProductFeatureConstraints() {
        return productFeatureConstraints;
    }

    public Feature findProductFeatureByName(String featureName) {
        for (Feature feature : getProductFeatures()) {
            if (feature.name.equalsIgnoreCase(featureName)) {
                return feature;
            }
        }

        throw new ObjectNotFoundException(featureName);