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

import { LocalNotifications } from '@ionic-native/local-notifications';
import { BrowserGetTestability } from '@angular/platform-browser/src/browser/testability';
import { VitaminCPage } from '../vitamin-c/vitamin-c';
import { ZincPage } from '../zinc/zinc';



@IonicPage()
@Component({
  selector: 'page-alarm',
  templateUrl: 'alarm.html',
})
export class AlarmPage {


  constructor(public navCtrl: NavController, private localNoti: LocalNotifications, private platform: Platform, public alertCtrl: AlertController){

  }




  
  btnPushClicked(){
    this.platform.ready().then(() => {
      
      this.localNoti.schedule({
        id: 1,
        title: 'Vita-Alarm!',
        text: 'It\'s Time to take your Vitamin!',
        trigger: {at: new Date(new Date().getTime() + 500000)},
        data: {"Good job!":""},
        led: 'FF0000',
        
     });
    });

    const alert = this.alertCtrl.create({
      title: 'Vita-Alarm!',
      subTitle: 'Alarm has been set!',
      buttons: ['OK']
    });
    alert.present();
  }


  
  vitaminC(){
    this.platform.ready().then(() => {
      this.localNoti.schedule({
        id: 1,
        title: 'Vita-Alarm!',
        text: 'It\'s Time to take Vitamin C!',
        trigger: {at: new Date(new Date().getTime() + 500000)},
        data: {"Good job!":""},
        led: 'FF0000',
        
     });
    });

    const alert = this.alertCtrl.create({
      title: 'Vita-Alarm!',
      subTitle: 'Alarm has been set!',
      buttons: ['OK']
    });
    alert.present();
  }





  zinc(){
    this.platform.ready().then(() => {
      this.localNoti.schedule({
        id: 1,
        title: 'Vita-Alarm!',
        text: 'It\'s Time to take Zinc!',
        trigger: {at: new Date(new Date().getTime() + 500000)},
        data: {"Good job!":""},
        led: 'FF0000',
        
     });
    });

    const alert = this.alertCtrl.create({
      title: 'Vita-Alarm!',
      subTitle: 'Alarm has been set!',
      buttons: ['OK']
    });
    alert.present();
  }




  openVitaminCPage() {
    this.navCtrl.push(VitaminCPage);
  }

  openZincPage() {
    this.navCtrl.push(ZincPage);
  }





}
