class AdminLogsRepairCache implements JsonRpcMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    final Optional<Long> blockNumber = requestContext.getOptionalParameter(0, Long.class);

    blockNumber.ifPresent(
        bn ->
            blockchainQueries
                .getBlockchain()
                .getBlockByNumber(bn)
                .orElseThrow(() -> new IllegalStateException("Block not found, " + bn)));

    final TransactionLogBloomCacher transactionLogBloomCacher =
        blockchainQueries
            .getTransactionLogBloomCacher()
            .orElseThrow(
                () ->
                    new InternalError(
                        "Error attempting to get TransactionLogBloomCacher. Please ensure that the TransactionLogBloomCacher is enabled."));

    transactionLogBloomCacher.ensurePreviousSegmentsArePresent(
        blockNumber.orElse(blockchainQueries.headBlockNumber()), true);

    final Map<String, String> response =
        Map.of(
            "Status",
            transactionLogBloomCacher.getCachingStatus().isCaching()
                ? "Already running"
                : "Started");

    return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), response);
  }

  public  AdminLogsRepairCache(final BlockchainQueries blockchainQueries);

}