import { Injectable } from '@angular/core'
import { BehaviorSubject } from 'rxjs'

@Injectable()
/**
 * LoadingService is used for providing the info whether all data is loaded, which is used for loading screens
 */
export class LoadingService {
	private readonly loadingSubject = new BehaviorSubject<boolean>(false)
	loading$ = this.loadingSubject.asObservable()

	/**
	 * Show the loading screen
	 */
	showLoading() {
		this.loadingSubject.next(true)
	}

	/**
	 * Hide the loading screen
	 */
	hideLoading() {
		this.loadingSubject.next(false)
	}
}
