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

@Injectable()
export class GlobalService {
  // in akharin request ro bar mighardone ke betonam be har parastar ke mikham bedam
  request = new BehaviorSubject<any>('');
  tokenLogin;
  notificationData = new BehaviorSubject<any>('');
  nurse = new BehaviorSubject<any>('');
  //  dar component map request estefade shode baray gereftan data y request , dar component resume ham estefade mishe
  requests = new BehaviorSubject<any>('');
  replaceStatus(status: string) {
    const statusRequest = JSON.parse(localStorage.getItem('basics'))['statuses'];
    const result = statusRequest.find(obj => {
      return obj.id === status;
    });
    return result.name;
  }
}
