import { Injectable } from '@angular/core';
import { ToastController, AlertController } from '@ionic/angular';

@Injectable({
  providedIn: 'root'
})
export class AlertService {

  constructor(private toastController: ToastController, private alertController: AlertController) { }
  async presentToast(message: any) {
    const toast = await this.toastController.create({
      message: message,
      duration: 5000,
      position: 'bottom',
      color: 'dark',
      buttons: [{ icon: 'close', role: 'cancel' }]
    });
    toast.present();
  }

  async presentAlert(title: any, message: any, buttons: any) {
    const alert = await this.alertController.create({
      header: title,
      message: message,
      cssClass: 'light',
      buttons: ['OK']
    });
    await alert.present();
  }
}
