class PrivUnsubscribe extends AbstractPrivateSubscriptionMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    try {
      final PrivateUnsubscribeRequest unsubscribeRequest =
          getMapper().mapPrivateUnsubscribeRequest(requestContext);

      checkIfPrivacyGroupMatchesAuthenticatedEnclaveKey(
          requestContext, unsubscribeRequest.getPrivacyGroupId());

      final boolean unsubscribed = subscriptionManager().unsubscribe(unsubscribeRequest);

      return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), unsubscribed);
    } catch (final InvalidSubscriptionRequestException isEx) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), JsonRpcError.INVALID_REQUEST);
    } catch (final SubscriptionNotFoundException snfEx) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), JsonRpcError.SUBSCRIPTION_NOT_FOUND);
    }
  }

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

}