import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { AddAction } from '../models/add-action.enum';

@Injectable()
export class ServiceComm {
  private componentTitleSource = new BehaviorSubject<string>('');
  public componentTitle = this.componentTitleSource.asObservable();

  private refreshRequestSource = new BehaviorSubject<AddAction>(AddAction.None);
  public refreshRequest = this.refreshRequestSource.asObservable();

  constructor() { }

  UpdatedComponentTitle(title: string) {
    this.componentTitleSource.next(title);
  }

  RefreshData(refreshAfter: AddAction) {
    this.refreshRequestSource.next(refreshAfter);
  }
}
