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','lib/domReady', 'lib/highlight/highlight.pack'], function (vcClass, 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
    var vc = vcClass.create([
      ['title', 'string'],
      ['subTitle', 'string'],
      ['pubDate', 'date'],
      ['author', 'text']
    ]).fromJson(json);

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

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

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

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

