#include <iostream>
#include "../JString.h"
#include "../JFile.h"
#include <string>
#include <sstream>

int main(int argc, char **argv) {

   coreutils::JFile test1("jfile_test.data");
   std::cout << test1 << std::endl;
   
   test1["name"] = "Cohen";

   std::cout << test1 << std::endl;

   test1["health"] = "100";
   test1["comment"] = "this is a comment";
   test1["racex"] = "elvin";
   test1["race"] = "human";
   test1["array"] = "[\"test1\",\"test2\",\"test3\"]";
   test1["tester"] = "test field";
   test1["object1"] = "{\"attr1\":\"value1\",\"attr2\":\"value2\",\"attr3\":\"value3\"}";
   test1["object1.attr2"] = "{\"xattr1\":\"xvalue1\",\"xattr2\":\"xvalue2\",\"xattr3\":\"xvalue3\"}";
   test1["object1.attr3"] = "Im not an object";
//   test1["age"] = 64; future

   std::cout << test1 << std::endl;
   
   std::cout << test1["name"] << std::endl;
   std::cout << test1["health"] << std::endl;
   std::cout << test1["comment"] << std::endl;
   std::cout << test1["racex"] << std::endl;
   std::cout << test1["race"] << std::endl;
   std::cout << test1["array"] << std::endl;
   std::cout << test1["tester"] << std::endl;
   std::cout << test1["object1"] << std::endl;
   std::cout << test1["object1.attr2"] << std::endl;   
   std::cout << test1["object1.attr2.xattr3"] << std::endl;   
   std::cout << test1["object1.attr3"] << std::endl;   
   std::cout << test1["array[0]"] << std::endl;   
   std::cout << test1["array[1]"] << std::endl;   
   std::cout << test1["array[2]"] << std::endl;   

   std::cout << test1.pretty() << std::endl;
   
   return 0;
}

