package de.ivu.elect.business.system.boundary;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import javax.ejb.Stateless;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;

import de.ivu.elect.business.system.control.BackgroundServiceStatusProvider;
import de.ivu.elect.business.system.entity.BackgroundServiceEvent;
import de.ivu.elect.business.system.entity.BackgroundServiceStatus;
import de.ivu.elect.business.system.entity.SystemLogQuelle;

@Stateless
public class BackgroundServiceStatusErmittler {

  @Inject
  Instance<BackgroundServiceEvent> backgroundServiceEvents;

  public Map<SystemLogQuelle, BackgroundServiceStatus> getBackgroundServiceStatus() {
    return BackgroundServiceStatusProvider.getStatus();
  }

  public Set<SystemLogQuelle> getBackgroundServiceEvents() {
    Set<SystemLogQuelle> result = new HashSet<>();
    backgroundServiceEvents.forEach(s -> result.add(s.getServiceName()));
    return result;
  }
}
