package org.pmiops.workbench;

import com.blockscore.models.PaginatedResult;
import com.blockscore.models.Person;
import com.blockscore.net.BlockscoreApiClient;
import javax.inject.Provider;
import org.pmiops.workbench.google.CloudStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BlockscoreServiceImpl implements BlockscoreService {

  private final CloudStorageService cloudStorageService;
  private String apiKey = null;

  @Autowired
  public BlockscoreServiceImpl(CloudStorageService cloudStorageService) {
    this.cloudStorageService = cloudStorageService;
    apiKey = cloudStorageService.readBlockscoreApiKey();
  }

  public PaginatedResult<Person> listPeople() {
    BlockscoreApiClient client = new BlockscoreApiClient(apiKey);
    return client.listPeople();
  }
}

@@ -443,16 +443,25 @@
 e final 
+Provider%3C
 CloudSto
@@ -463,32 +463,33 @@
 udStorageService
+%3E
  cloudStorageSer
@@ -488,24 +488,32 @@
 orageService
+Provider
 ;%0A  private 
@@ -579,16 +579,25 @@
 iceImpl(
+Provider%3C
 CloudSto
@@ -607,16 +607,17 @@
 eService
+%3E
  cloudSt
@@ -628,16 +628,24 @@
 eService
+Provider
 ) %7B%0A    
@@ -668,16 +668,24 @@
 eService
+Provider
  = cloud
@@ -698,18 +698,107 @@
 eService
-;%0A
+Provider;%0A  %7D%0A%0A  public PaginatedResult%3CPerson%3E listPeople() %7B%0A    if (apiKey == null) %7B%0A  
     apiK
@@ -821,16 +821,30 @@
 eService
+Provider.get()
 .readBlo
@@ -866,58 +866,11 @@
 ;%0A  
-%7D%0A%0A  public PaginatedResult%3CPerson%3E listPeople() %7B
+  %7D
 %0A   

Move Blockscore API key fetch until later to fix dev (#317)