class SubscriptionBuilder {

  public Subscription build(
      final long subscriptionId, final String connectionId, final SubscribeRequest request) {
    final SubscriptionType subscriptionType = request.getSubscriptionType();
    switch (subscriptionType) {
      case NEW_BLOCK_HEADERS:
        {
          return new NewBlockHeadersSubscription(
              subscriptionId, connectionId, request.getIncludeTransaction());
        }
      case LOGS:
        {
          return logsSubscription(subscriptionId, connectionId, request);
        }
      case SYNCING:
        {
          return new SyncingSubscription(subscriptionId, connectionId, subscriptionType);
        }
      case NEW_PENDING_TRANSACTIONS:
      default:
        return new Subscription(
            subscriptionId, connectionId, subscriptionType, request.getIncludeTransaction());
    }
  }

}