class GetCommittees extends AbstractHandler implements Handler {

  @OpenApi(
      path = ROUTE,
      method = HttpMethod.GET,
      summary = "Get the committee assignments for an epoch.",
      tags = {TAG_BEACON},
      queryParams = {
        @OpenApiParam(name = EPOCH, description = EPOCH_QUERY_DESCRIPTION, required = true),
      },
      description = "Returns committee assignments for each slot in a specified epoch.",
      responses = {
        @OpenApiResponse(
            status = RES_OK,
            content = @OpenApiContent(from = Committee.class, isArray = true)),
        @OpenApiResponse(status = RES_BAD_REQUEST, description = "Missing a query parameter"),
        @OpenApiResponse(status = RES_NO_CONTENT, description = NO_CONTENT_PRE_GENESIS),
        @OpenApiResponse(status = RES_INTERNAL_ERROR)
      })
  @Override
  public void handle(Context ctx) throws Exception {
    try {
      UInt64 epoch = getParameterValueAsEpoch(ctx.queryParamMap(), EPOCH);
      final SafeFuture<Optional<List<Committee>>> future = provider.getCommitteesAtEpoch(epoch);
      UInt64 slot = BeaconStateUtil.compute_start_slot_at_epoch(epoch);
      ctx.header(Header.CACHE_CONTROL, getMaxAgeForSlot(provider, slot));
      if (provider.isFinalized(slot)) {
        handlePossiblyGoneResult(ctx, future);
      } else {
        handlePossiblyMissingResult(ctx, future);
      }
    } catch (final IllegalArgumentException e) {
      ctx.result(jsonProvider.objectToJSON(new BadRequest(e.getMessage())));
      ctx.status(SC_BAD_REQUEST);
    }
  }

  public  GetCommittees(ChainDataProvider provider, JsonProvider jsonProvider);

}