class RemoteValidatorApiHandler implements ValidatorApiChannel {

  @Override
  public SafeFuture<Optional<List<ValidatorDuties>>> getDuties(
      final UInt64 epoch, final Collection<BLSPublicKey> publicKeys) {
    if (publicKeys.isEmpty()) {
      return SafeFuture.completedFuture(Optional.of(Collections.emptyList()));
    }

    return asyncRunner.runAsync(
        () -> {
          final List<BLSPubKey> blsPubKeys =
              publicKeys.stream().map(BLSPubKey::new).collect(Collectors.toList());
          final ValidatorDutiesRequest validatorDutiesRequest =
              new ValidatorDutiesRequest(epoch, blsPubKeys);

          final List<ValidatorDuties> validatorDuties =
              apiClient.getDuties(validatorDutiesRequest).stream()
                  .map(this::mapToApiValidatorDuties)
                  .collect(Collectors.toList());

          return Optional.of(validatorDuties);
        });
  }

  public  RemoteValidatorApiHandler(final ServiceConfig config, final AsyncRunner asyncRunner);
  @VisibleForTesting public  RemoteValidatorApiHandler(
      final ValidatorRestApiClient apiClient, final AsyncRunner asyncRunner);

}