class PermReloadPermissionsFromFile implements JsonRpcMethod {

  @Override
  public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    if (!accountWhitelistController.isPresent() && !nodesWhitelistController.isPresent()) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), JsonRpcError.PERMISSIONING_NOT_ENABLED);
    }

    try {
      accountWhitelistController.ifPresent(AccountLocalConfigPermissioningController::reload);
      nodesWhitelistController.ifPresent(NodeLocalConfigPermissioningController::reload);
      return new JsonRpcSuccessResponse(requestContext.getRequest().getId());
    } catch (Exception e) {
      return new JsonRpcErrorResponse(
          requestContext.getRequest().getId(), JsonRpcError.ALLOWLIST_RELOAD_ERROR);
    }
  }

  public  PermReloadPermissionsFromFile(
      final Optional<AccountLocalConfigPermissioningController> accountWhitelistController,
      final Optional<NodeLocalConfigPermissioningController> nodesWhitelistController);

}