class BloomFilterHttpService {

    @Put("/{name}")
    public HttpResponse create(@Param String name,
                               @RequestObject JsonNode req) {
        final JsonNode expectedInsertions = req.get("expectedInsertions");
        final JsonNode fpp = req.get("fpp");
        final JsonNode validPeriodAfterCreate = req.get("validPeriod") == null ?
                req.get("validPeriodAfterCreate") : req.get("validPeriod");
        final JsonNode validPeriodAfterAccess = req.get("validPeriodAfterAccess");
        final JsonNode overwrite = req.get("overwrite");
        final ExpirableBloomFilterConfig config = new ExpirableBloomFilterConfig();

        if (expectedInsertions != null) {
            config.setExpectedInsertions(expectedInsertions.intValue());
        }
        if (fpp != null) {
            config.setFpp(fpp.doubleValue());
        }

        if (validPeriodAfterCreate != null) {
            config.setValidPeriodAfterCreate(Duration.ofSeconds(validPeriodAfterCreate.intValue()));
        }

        if (validPeriodAfterAccess != null) {
            config.setValidPeriodAfterAccess(Duration.ofSeconds(validPeriodAfterAccess.intValue()));
        }

        final CreateFilterResult<?> createResult;
        if (overwrite != null && overwrite.isBoolean() && overwrite.asBoolean()) {
            createResult = bloomFilterManager.createFilter(name, config, true);
        } else {
            createResult = bloomFilterManager.createFilter(name, config);
        }
        return HttpResponse.of(
                createResult.isCreated() ? HttpStatus.CREATED : HttpStatus.OK,
                MediaType.JSON_UTF_8,
                MAPPER.valueToTree(createResult.getFilter()).toString());
    }

    public  BloomFilterHttpService(BloomFilterManager<?, ? super ExpirableBloomFilterConfig> bloomFilterManager);

}