package com.google.sps.tool;

import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

import java.util.List;
import java.util.ArrayList;
import com.google.sps.data.Card;
import com.google.sps.data.Folder;

public class EntityTestingTool {

  public static boolean checkForNoNullValues(Entity card) {
    return (card.getProperty("blobKey") != null  &&
      card.getProperty("labels") != null &&
      card.getProperty("textTranslated") != null &&
      card.getProperty("textNotTranslated") != null &&
      card.getProperty("fromLang") != null &&
      card.getProperty("toLang") != null &&
      card.getProperty("cardKey") != null);
  }

  public static List<Folder> populateDatastoreWithFolders(Folder folderA, Folder folderB, DatastoreService datastore, String USERKEY) {
    
    Entity folderEntityA = folderA.createEntity(KeyFactory.stringToKey(USERKEY));
    Entity folderEntityB = folderB.createEntity(KeyFactory.stringToKey(USERKEY));

    // Update entity in datastore 
    datastore.put(folderEntityA);
    datastore.put(folderEntityB);

    List<Folder> folders = new ArrayList<>();
    folders.add(new Folder(folderEntityA));
    folders.add(new Folder(folderEntityB));

    return folders;
  }

  public static List<Card> populateDatastoreWithCards(Card cardA, Card cardB, DatastoreService datastore, String FOLDERKEY) {
    
    Entity cardEntityA = cardA.createEntity(KeyFactory.stringToKey(FOLDERKEY));
    Entity cardEntityB = cardB.createEntity(KeyFactory.stringToKey(FOLDERKEY));

    // Update entity in datastore 
    datastore.put(cardEntityA);
    datastore.put(cardEntityB);

    List<Card> cards = new ArrayList<>();
    cards.add(new Card(cardEntityA));
    cards.add(new Card(cardEntityB));

    return cards;
  }

    
}
@@ -983,23 +983,23 @@
  String 
-USERKEY
+userKey
 ) %7B%0A    
@@ -1066,31 +1066,31 @@
 stringToKey(
-USERKEY
+userKey
 ));%0A    Enti
@@ -1156,15 +1156,15 @@
 Key(
-USERKEY
+userKey
 ));%0A
@@ -1541,25 +1541,25 @@
  String 
-FOLDERKEY
+folderKey
 ) %7B%0A    
@@ -1622,33 +1622,33 @@
 stringToKey(
-FOLDERKEY
+folderKey
 ));%0A    Enti
@@ -1710,17 +1710,17 @@
 Key(
-FOLDERKEY
+folderKey
 ));%0A

Fix styling issue in EntityTestingTool.java