class PostAggregateAndProof implements Handler {

  @OpenApi(
      path = ROUTE,
      method = HttpMethod.POST,
      summary =
          "Verifies given aggregate and proof and publishes it on appropriate gossipsub topic.",
      tags = {TAG_VALIDATOR},
      requestBody =
          @OpenApiRequestBody(content = {@OpenApiContent(from = SignedAggregateAndProof.class)}),
      description = "Aggregates all attestations matching given attestation data root and slot.",
      responses = {
        @OpenApiResponse(status = RES_OK, description = "Successfully processed attestation."),
        @OpenApiResponse(status = RES_BAD_REQUEST, description = "Invalid parameter supplied."),
        @OpenApiResponse(status = RES_INTERNAL_ERROR, description = "Beacon node internal error.")
      })
  @Override
  public void handle(Context ctx) throws Exception {
    try {
      final SignedAggregateAndProof signedAggregateAndProof =
          jsonProvider.jsonToObject(ctx.body(), SignedAggregateAndProof.class);

      provider.sendAggregateAndProof(signedAggregateAndProof);
      ctx.status(SC_OK);
    } catch (final JsonMappingException e) {
      ctx.result(jsonProvider.objectToJSON(new BadRequest(e.getMessage())));
      ctx.status(SC_BAD_REQUEST);
    } catch (Exception e) {
      ctx.status(SC_INTERNAL_SERVER_ERROR);
    }
  }

  public  PostAggregateAndProof(
      final ValidatorDataProvider provider, final JsonProvider jsonProvider);

}