import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';

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

  constructor() { }

  public static timeoutEvents = environment.timeoutEvents;
  public static startUp = false;
  public static updateStrutture = false;
  public static clienteCambiato = false;
  public static caricaDati = false;
  public static gotoPage = false;
  public static newPage = "";
  public static strutturaSelected = false;
  public static manageBackButton = false;
  public static strutturaSelectedHome = false;

  static setStartUp()
  {
    this.startUp = true;
    setTimeout(() => {
      this.startUp = false;
   }, EventsService.timeoutEvents);
  }

  static setUpdateStrutture()
  {
    this.updateStrutture = true;
    setTimeout(() => {
      this.updateStrutture = false;
   }, EventsService.timeoutEvents);
  }

  static setClienteCambiato()
  {
    this.clienteCambiato = true;
    setTimeout(() => {
      this.clienteCambiato = false;
   }, EventsService.timeoutEvents);
  }

  static setCaricaDati()
  {
    this.caricaDati = true;
    setTimeout(() => {
      this.caricaDati = false;
   }, EventsService.timeoutEvents);
  }

  static setGotoPage(page)
  {
    this.newPage = page;
    this.gotoPage = true;
    setTimeout(() => {
      this.gotoPage = false;
      this.newPage = "";
   }, EventsService.timeoutEvents);
  }

  static setStrutturaSelected()
  {
    this.strutturaSelected = true;
    setTimeout(() => {
      this.strutturaSelected = false;
   }, EventsService.timeoutEvents);
  }

  static setManageBackButton()
  {
    this.manageBackButton = true;
    setTimeout(() => {
      this.manageBackButton = false;
   }, EventsService.timeoutEvents);
  }

  static setStrutturaSelectedHome()
  {
    this.strutturaSelectedHome = true;
    setTimeout(() => {
      this.strutturaSelectedHome = false;
   }, EventsService.timeoutEvents);
  }
} 