class GithubRateHealthCheck implements HealthIndicator {

    @Override
    public Health health() {
        final GithubRateLimit rateLimit = githubGateway.getRateLimit().getCore();
        if (rateLimit.getRemaining() == 0) {
            return addDetails(Health.down(), rateLimit).build();
        }
        if (rateLimit.getRemaining() > calculateThreshold(rateLimit.getLimit())) {
            return addDetails(Health.up(), rateLimit).build();
        }
        return addDetails(Health.status(new Status("THRESHOLD REACHED")), rateLimit).build();
    }

    public  GithubRateHealthCheck(final GithubGateway githubGateway,
                                 @Value("${io.fundrequest.health.github.api-rate-limit.threshold-percentage:20}") final int thresholdPercentage);

}