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

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

  constructor() {
    
  }

  static startup : boolean = false;
  static updateStrutture : boolean = false;
  static caricaDati : boolean = false;
  static strutturaSelected : boolean = false;
  static strutturaSelectedHome : boolean = false;
  static manageBackButton : boolean = false;
  static clienteCambiato : boolean = false;
  static redirect : string = '';
  
  static setStartUp()
  {
    EventsService.startup = true;
    setTimeout(() => {
      EventsService.startup = false;
    }, environment.eventsTime);
  }

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

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

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

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

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

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

  static setRedirect(page: string)
  {
    EventsService.redirect = page;
    setTimeout(() => {
      EventsService.redirect = '';
    }, environment.eventsTime);
  }
}