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

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

  constructor(
    public alertController: AlertController,
    private animationController: AnimationController,
    ) { }

  async presentAlert(message:string) {
    const alert = await this.alertController.create({
      cssClass: 'my-custom-class',
      header: 'Mensagem do sistema',
      message: message,
      buttons: ['OK']
    });

    await alert.present();
  }

  async presentErrorMessage(message:string) {
    const alert = await this.alertController.create({
      cssClass: 'my-custom-class',
      header: 'Mensagem de erro',
      message: message,
    });

    await alert.present();
    
    setTimeout(()=>{
      alert.dismiss();
    }, 2500);
  }

}
