class GetChainHead implements Handler {

  @OpenApi(
      path = ROUTE,
      method = HttpMethod.GET,
      summary = "Get information about the chain head.",
      tags = {TAG_BEACON},
      description =
          "Returns information about the head of the beacon chain including the finalized and "
              + "justified information.",
      responses = {
        @OpenApiResponse(status = RES_OK, content = @OpenApiContent(from = BeaconChainHead.class)),
        @OpenApiResponse(status = RES_NO_CONTENT, description = NO_CONTENT_PRE_GENESIS),
        @OpenApiResponse(status = RES_INTERNAL_ERROR)
      })
  @Override
  public void handle(final Context ctx) throws JsonProcessingException {
    ctx.header(Header.CACHE_CONTROL, CACHE_NONE);
    final Optional<BeaconChainHead> beaconChainHead = provider.getHeadState();
    if (beaconChainHead.isPresent()) {
      ctx.result(jsonProvider.objectToJSON(beaconChainHead.get()));
    } else {
      ctx.status(SC_NO_CONTENT);
    }
  }

  public  GetChainHead(final ChainDataProvider provider, final JsonProvider jsonProvider);

}