import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { FleioId } from '@fleio-api/base-model/base-fleio-object.model';

@Injectable({
  providedIn: 'root'
})
export class ServiceCycleEditTrackerService {
  private serviceCycleEditBS: BehaviorSubject<FleioId> = new BehaviorSubject<FleioId>(null);
  public readonly observableServiceCycleEdit: Observable<FleioId> = this.serviceCycleEditBS.asObservable();

  constructor() { }

  editedServiceCycle(cycleId?: FleioId) {
    if (cycleId) {
      this.serviceCycleEditBS.next(cycleId);
    } else {
      this.serviceCycleEditBS.next('unknown-id');
    }
  }
}
