class PrivSubscribe extends AbstractPrivateSubscriptionMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    try {
      final String enclavePublicKey =
          enclavePublicKeyProvider.getEnclaveKey(requestContext.getUser());
      final PrivateSubscribeRequest subscribeRequest =
          getMapper().mapPrivateSubscribeRequest(requestContext, enclavePublicKey);

      checkIfPrivacyGroupMatchesAuthenticatedEnclaveKey(
          requestContext, subscribeRequest.getPrivacyGroupId());

      final Long subscriptionId = subscriptionManager().subscribe(subscribeRequest);

      return new JsonRpcSuccessResponse(
          requestContext.getRequest().getId(), Quantity.create(subscriptionId));
    } catch (final InvalidSubscriptionRequestException isEx) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), JsonRpcError.INVALID_REQUEST);
    }
  }

  public  PrivSubscribe(
      final SubscriptionManager subscriptionManager,
      final SubscriptionRequestMapper mapper,
      final PrivacyController privacyController,
      final EnclavePublicKeyProvider enclavePublicKeyProvider);

}