requirejs.config({
  baseUrl: '../js/src',
  paths : {
    'lib': '../lib'
  }
});

var json = {
  "@type":"koral:docGroup",
  "operation":"operation:or",
  "operands":[
    {
      "@type":"koral:docGroup",
      "operation":"operation:and",
      "operands":[
        {
          "@type":"koral:doc",
          "key":"title",
          "value":"Der Birnbaum",
          "match":"match:eq"
        },
        {
          "@type":"koral:doc",
          "key":"pubPlace",
          "value":"Mannheim",
          "type" : "type:regex",
          "match":"match:contains"
        },
        {
          "@type":"koral:docGroup",
          "operation":"operation:or",
          "operands":[
            {
              "@type":"koral:doc",
              "key":"subTitle",
              "value":"Aufzucht und Pflege",
              "match":"match:eq"
            },
            {
              "@type":"koral:doc",
              "key":"subTitle",
              "value":"Gedichte",
              "match":"match:eq",
              "rewrites" : [
                {
                  "@type": "koral:rewrite",
                  "src" : "policy",
                  "operation" : "operation:injection",
                }
              ]
            },
            {
              "@type":"koral:docGroupRef",
              "ref":"@kalamar/myCorpus"
            }
          ]
        }
      ]
    },
    {
      "@type":"koral:doc",
      "key":"pubDate",
      "type":"type:date",
      "value":"2015-03-05",
      "match":"match:geq"
    }
  ]
};

var collections = [
  {
    "statistics":{
      "paragraphs":2034752,
      "documents":196510,
      "tokens":51545081,
      "sentences":4116282
    },
    "query":[
      {
	"@value":{
	  "@field":"korap:field#corpusID",
	  "@value":"WPD",
	  "@type":"korap:term"
	},
	"@type":"korap:meta-filter"
      }
    ],
    "name":"Wikipedia",
    "path":"Wikipedia",
    "description":"Die freie Enzyklopädie",
    "shared":false,
    "managed":true,
    "created":"2015-04-01T23:04:32.000+02:00",
    "foundries":"",
    "id":"ZGU0ZTllNTFkYzc3M2VhZmViYzdkYWE2ODI5NDc3NTk4NGQ1YThhOTMwOTNhOWYxNWMwN2M3Y2YyZmE3N2RlNQ=="
  }
];


require(['vc','vc/fragment','lib/domReady', 'lib/highlight/highlight.pack'], function (vcClass, fragmentClass, domReady) {

  var loc = KorAP.Locale;
  
  //corpus statistic
  var statistic = {
  		"documents":1,
  		"tokens":222222,
  		"sentences":33333,
  		"paragraphs":444
	};

/*
  loc.AND = 'und';
  loc.OR  = 'oder';
  loc.VC_subTitle = 'Untertitel';
  loc.VC_title = 'Titel';
  loc.VC_pubDate = 'Veröffentlichungsdatum';
  loc.VC_pubPlace = 'Veröffentlichungsort';
*/

  domReady(function() {

    // Create a new virtual collection by passing a based json object and
    // field menu information
    KorAP.vc = vcClass.create([
      ['title', 'string'],
      ['subTitle', 'string'],
      ['pubDate', 'date'],
      ['author', 'text']
    ]).fromJson(json);

    document.getElementById('vc-view').appendChild(KorAP.vc.element());

    KorAP.vc.open();

    // show the current JSON serialization
    KorAP.showJSON = function () {
      var json = document.getElementById("json");
      json.innerHTML = JSON.stringify(KorAP.vc.root().toJson(), null, '  ');
      hljs.highlightBlock(json);
    };

    // show the current query serialization
    KorAP.showQuery = function () {
      document.getElementById("query").innerHTML = KorAP.vc.root().toQuery();
    };

    // make the current vc persistant
    KorAP.makeVCPersistant = function () {
      KorAP.vc.makePersistant();
    };
    
    //get the corpus statistic (demo function)
    KorAP.API.getCorpStat = function(collQu, cb){
    	return cb(statistic);
    };


    var f = fragmentClass.create();
    f.add("author", "Peter");
    f.add("title", "Sonstiges");
    f.add("subTitle", "Anderes");
    
    document.getElementById('fragment').appendChild(
      f.element()
    );
    
  });
});

