// Path: src/main/java/com/github/ferstl/maven/pomenforcers/model/PluginModel.java
// public class PluginModel extends ArtifactModel {
// 
//   @XmlElementWrapper(name = "configuration", namespace = "http://maven.apache.org/POM/4.0.0")
//   @XmlAnyElement
//   private List<Element> configItems;
// 
//   @XmlElement(namespace = "http://maven.apache.org/POM/4.0.0")
//   private DependenciesModel dependencies;
// 
//   PluginModel() {
//   }
// 
//   public PluginModel(String groupId, String artifactId, String version) {
//     super(groupId, artifactId, version);
//   }
// 
//   public boolean isConfigured() {
//     return this.configItems != null && !this.configItems.isEmpty();
//   }
// 
//   public List<DependencyModel> getDependencies() {
//     return this.dependencies != null ? this.dependencies.getDependencies() : Collections.emptyList();
//   }
// 
//   @Override
//   public boolean equals(Object obj) {
//     if (obj == this) {
//       return true;
//     }
//     if (!(obj instanceof PluginModel)) {
//       return false;
//     }
// 
//     PluginModel other = (PluginModel) obj;
//     return super.equals(other)
//         // TODO: Element implementations may not implement equals()!!
//         && Objects.equals(this.configItems, other.configItems)
//         && Objects.equals(this.dependencies, other.dependencies);
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hash(super.hashCode(), this.configItems, this.dependencies);
//   }
// }
// 
// Path: src/main/java/com/github/ferstl/maven/pomenforcers/ErrorReport.java
// public static <T> String toList(Collection<T> collection) {
//   return toList(collection, Function.identity());
// }


import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import com.github.ferstl.maven.pomenforcers.model.PluginModel;
import static com.github.ferstl.maven.pomenforcers.ErrorReport.toList;
  public void setManageDependencies(boolean manageDependencies) {
    this.manageDependencies = manageDependencies;
  }

  @Override
  protected PedanticEnforcerRule getDescription() {
    return PedanticEnforcerRule.PLUGIN_CONFIGURATION;
  }

  @Override
  protected void accept(PedanticEnforcerVisitor visitor) {
    visitor.visit(this);
  }

  @Override
  protected void doEnforce(ErrorReport report) {
    if (this.manageVersions) {
      enforceManagedVersions(report);
    }

    if (this.manageConfigurations) {
      enforceManagedConfiguration(report);
    }

    if (this.manageDependencies) {
      enforceManagedDependencies(report);
    }
  }

  private void enforceManagedVersions(ErrorReport report) {
// Path: src/main/java/com/github/ferstl/maven/pomenforcers/model/PluginModel.java
// public class PluginModel extends ArtifactModel {
// 
//   @XmlElementWrapper(name = "configuration", namespace = "http://maven.apache.org/POM/4.0.0")
//   @XmlAnyElement
//   private List<Element> configItems;
// 
//   @XmlElement(namespace = "http://maven.apache.org/POM/4.0.0")
//   private DependenciesModel dependencies;
// 
//   PluginModel() {
//   }
// 
//   public PluginModel(String groupId, String artifactId, String version) {
//     super(groupId, artifactId, version);
//   }
// 
//   public boolean isConfigured() {
//     return this.configItems != null && !this.configItems.isEmpty();
//   }
// 
//   public List<DependencyModel> getDependencies() {
//     return this.dependencies != null ? this.dependencies.getDependencies() : Collections.emptyList();
//   }
// 
//   @Override
//   public boolean equals(Object obj) {
//     if (obj == this) {
//       return true;
//     }
//     if (!(obj instanceof PluginModel)) {
//       return false;
//     }
// 
//     PluginModel other = (PluginModel) obj;
//     return super.equals(other)
//         // TODO: Element implementations may not implement equals()!!
//         && Objects.equals(this.configItems, other.configItems)
//         && Objects.equals(this.dependencies, other.dependencies);
//   }
// 
//   @Override
//   public int hashCode() {
//     return Objects.hash(super.hashCode(), this.configItems, this.dependencies);
//   }
// }
// 
// Path: src/main/java/com/github/ferstl/maven/pomenforcers/ErrorReport.java
// public static <T> String toList(Collection<T> collection) {
//   return toList(collection, Function.identity());
// }


// Path: src/main/java/com/github/ferstl/maven/pomenforcers/PedanticPluginConfigurationEnforcer.java
import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import com.github.ferstl.maven.pomenforcers.model.PluginModel;
import static com.github.ferstl.maven.pomenforcers.ErrorReport.toList;

  public void setManageDependencies(boolean manageDependencies) {
    this.manageDependencies = manageDependencies;
  }

  @Override
  protected PedanticEnforcerRule getDescription() {
    return PedanticEnforcerRule.PLUGIN_CONFIGURATION;
  }

  @Override
  protected void accept(PedanticEnforcerVisitor visitor) {
    visitor.visit(this);
  }

  @Override
  protected void doEnforce(ErrorReport report) {
    if (this.manageVersions) {
      enforceManagedVersions(report);
    }

    if (this.manageConfigurations) {
      enforceManagedConfiguration(report);
    }

    if (this.manageDependencies) {
      enforceManagedDependencies(report);
    }
  }

  private void enforceManagedVersions(ErrorReport report) {
    Collection<PluginModel> versionedPlugins = searchForPlugins(PluginPredicate.WITH_VERSION);