class PrivFindPrivacyGroup implements JsonRpcMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    LOG.trace("Executing {}", RpcMethod.PRIV_FIND_PRIVACY_GROUP.getMethodName());

    final String[] addresses = requestContext.getRequiredParameter(0, String[].class);

    LOG.trace("Finding a privacy group with members {}", Arrays.toString(addresses));

    final List<PrivacyGroup> response;
    try {
      response =
          Arrays.asList(
              privacyController.findPrivacyGroup(
                  Arrays.asList(addresses),
                  enclavePublicKeyProvider.getEnclaveKey(requestContext.getUser())));
    } catch (final MultiTenancyValidationException e) {
      LOG.error("Unauthorized privacy multi-tenancy rpc request. {}", e.getMessage());
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), FIND_PRIVACY_GROUP_ERROR);
    } catch (final Exception e) {
      LOG.error("Failed to fetch privacy group", e);
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), FIND_PRIVACY_GROUP_ERROR);
    }
    return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), response);
  }

  public  PrivFindPrivacyGroup(
      final PrivacyController privacyController,
      final EnclavePublicKeyProvider enclavePublicKeyProvider);

}