/// <reference path="../scripts/typings/jquery/jquery.d.ts" />
/// <reference path="cheatsheet_klassen.ts" />
/// 
/// 

import G = CheatSheet.GO;

module CheatSheetClient {


 function print(s) {
  $("#content").append(s + "<br>");

 }

 $(document).ready(function() {
  console.log("Start...");

  $('#headline').css("color", "red");
  $('#headline').text('Cheat Sheet Demos');

  $("#content").append("Start...<hr>");


  var k = new G.Kunde(123, "Holger S.", 20000);
  var ausgabe = k.toString();



  var k1 = new CheatSheet.GO.Kunde(123, "Holger S.", 20000);

  $("#content").append(ausgabe + "<br>");
  var k2 = new CheatSheet.GO.Kunde(456, "Max M.", 500);


  var v = new CheatSheet.GO.Verbindung<G.Kontakt, G.Kunde>(k1, k2);
  var ausgabe2 = v.toString();

  $("#content").append(ausgabe2 + "<hr>");


  var e = calc(2, 10, null);


  print(e);
   // -------- Arrays


  type ZahlenArray = Array<number>;
  var lottozahlen2 : ZahlenArray;

  var lottozahlen : Array<number> = [11, 19, 28, 34, 41, 48, 5];
  let [z1, z2, z3, z4, z5, z6, zusatzzahl] = lottozahlen;
  print(`Zusatzzahl: ${zusatzzahl}`);
 

 // -------- Destructuring Von Objekten

  var k4 = new G.Kunde(123, "Holger S.", 20000);
  var a41 = `${k4.id}: ${k4.name}`;
  print("Objektzugriff: " + a41);
  let { id, name } = k4;
  var a42 = `${id}: ${name}`;
  print("Destructuring: " + a42);


  // Variable Declarations 


  if (true) {
   var x = 5;
  }
  print("x=" + x); // Ausgabe x=5 :-( JS-Schweinereien

  if (true) {
   let y = 5;
  }
  print("y=" + y); // Fehler!

  //const z = 5;
  //z = 6; // Fehler!

  console.log("fertig!");
 });

}