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

@Injectable()
export class ControllerRoutesService {

  // Observable string sources
  private missionAnnouncedSource = new Subject<string>();
  private missionConfirmedSource = new Subject<string>();
  private statisticsSource = new Subject<any>();

  // Observable string streams
  missionAnnounced$ = this.missionAnnouncedSource.asObservable();
  missionConfirmed$ = this.missionConfirmedSource.asObservable();
  setStatisticsObj = this.statisticsSource.asObservable();
  // Service message commands
  announceMission(mission: string) {
    this.missionAnnouncedSource.next(mission);
  }

  confirmMission(astronaut: string) {
    this.missionConfirmedSource.next(astronaut);
  }
  setStatistics(stats: any) {
  	this.statisticsSource.next(stats);
  }

  getTableStatistics(statistics: any)
  {
	this.statisticsSource.next(statistics);
  }
}