class DiskSpaceHealthCheck implements HealthCheck {

    @Override
    public HealthCheckResponse call() {
        long diskFreeInBytes;
        long totalInBytes;
        try {
            diskFreeInBytes = fileStore.getUsableSpace();
            totalInBytes = fileStore.getTotalSpace();
        } catch (IOException e) {
            throw new HealthCheckException("Failed to obtain disk space data", e);
        }

        long usedInBytes = totalInBytes - diskFreeInBytes;
        long threshold = (long) ((thresholdPercent / 100) * totalInBytes);

        //Formatter ensures that returned delimiter will be always the same
        Formatter formatter = new Formatter(Locale.US);

        return HealthCheckResponse.named("diskSpace")
                .state(threshold >= usedInBytes)
                .withData("percentFree", formatter.format("%.2f%%", 100 * ((double) diskFreeInBytes / totalInBytes)).toString())
                .withData("free", DiskSpaceHealthCheck.format(diskFreeInBytes))
                .withData("freeBytes", diskFreeInBytes)
                .withData("total", DiskSpaceHealthCheck.format(totalInBytes))
                .withData("totalBytes", totalInBytes)
                .build();
    }

      DiskSpaceHealthCheck(FileStore fileStore, double thresholdPercent);
    @Inject  DiskSpaceHealthCheck(
            @ConfigProperty(name = CONFIG_KEY_PATH, defaultValue = DEFAULT_PATH) File path,
            @ConfigProperty(name = CONFIG_KEY_THRESHOLD_PERCENT, defaultValue = "99.999") double thresholdPercent
    );
    private  DiskSpaceHealthCheck(Builder builder);

}