class PermGetNodesAllowlist implements JsonRpcMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    try {
      if (nodeWhitelistPermissioningController.isPresent()) {
        final List<String> enodeList =
            nodeWhitelistPermissioningController.get().getNodesAllowlist();

        return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), enodeList);
      } else {
        return new JsonRpcErrorResponse(
            requestContext.getRequest().getId(), JsonRpcError.NODE_ALLOWLIST_NOT_ENABLED);
      }
    } catch (P2PDisabledException e) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), JsonRpcError.P2P_DISABLED);
    }
  }

  public  PermGetNodesAllowlist(
      final Optional<NodeLocalConfigPermissioningController> nodeWhitelistPermissioningController);

}