import { Component } from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';

import { QuestsPage   }  from '../quests/Quests';
import { Stats        }  from '../stats/Stats';
import { Achievements } from '../Achievements/Achievements';
import { Inventory    } from "../Inventory/Inventory";
import {Inscription1Page} from "../inscription/inscription1/Inscription1";
/*
  Generated class for the Home page.

  See http://ionicframework.com/docs/v2/components/#navigation for more info on
  Ionic pages and navigation.
*/
@Component({
  selector: 'page-home',
  templateUrl: 'Home.html'
})
export class 
 {

  public user:{lvl:number, xp: number, score:number};

  constructor(public nav: NavController, public params:NavParams) {
    this.user = {
      lvl: 63,
      xp : 4854,
      score : 876421
    };

    console.log()

    let requete_base_de_donne_a_faire_salim:boolean;
    if(!params.get('comming')) {
      requete_base_de_donne_a_faire_salim = false;
      if (!params.get('comming') && !requete_base_de_donne_a_faire_salim)
        this.nav.setRoot(Inscription1Page);
    }
  }

  goTo(page) {
    switch (page) {
      case "QuestsPage" :
        this.nav.push(QuestsPage);
        break;
      case "Stats" :
        this.nav.push(Stats);
        break;
      case "Achievements" :
        this.nav.setRoot(Achievements);
        break;
      case "Inventory" :
        this.nav.setRoot(Inventory);
        break;
      case "Home" :
        this.nav.push(HomePage);
        break;
      default :
        console.log("OUps ! page = "+page);
        break;
    }

  }

}

HomePage