class DuplicateDetectionStrategyProvider extends ComponentSupport implements Provider<DuplicateDetectionStrategy<Record>> {

  @Override
  public DuplicateDetectionStrategy<Record> get() {
    switch (getStrategy()) {
      case HASH:
        return new HashBasedDuplicateDetectionStrategy();
      case DISK:
        return new DiskBackedDuplicateDetectionStrategy(applicationDirectories, maxHeapGb, maxDiskSizeGb);
      case BLOOM:
      default:
        return new BloomFilterDuplicateDetectionStrategy();
    }
  }

  @Inject public  DuplicateDetectionStrategyProvider(
      final ApplicationDirectories applicationDirectories,
      @Named("${nexus.maven.duplicate.detection.strategy:-BLOOM}") final String strategy,
      @Named("${nexus.maven.duplicate.detection.heap.max.gb:-1}") final int maxHeapGb,
      @Named("${nexus.maven.duplicate.detection.disk.max.gb:-10}") final int maxDiskSizeGb);

}