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

import java.io.Serializable;

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

import de.ivu.elect.business.internet.control.InternetPreasentationTypSupported;
import de.ivu.elect.business.internet.entity.InternetPraesentationTyp;
import de.ivu.elect.business.konfiguration.entity.ElectKonfigurationWerte;
import de.ivu.elect.business.konfiguration.entity.KonfigurationLoader;

@Stateless
public class InternetPraesentationErmittler implements Serializable {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient KonfigurationLoader konfigurationLoader;

  @Inject
  private transient InternetPreasentationTypSupported internetPreasentationTypSupported;

  public InternetPraesentationTyp getInternetPraesentationTyp() {
    InternetPraesentationTyp internetPraesentationTyp = konfigurationLoader.resolveEnumValue(ElectKonfigurationWerte.PRAESENTATION_TYP, InternetPraesentationTyp.class);

    if (internetPreasentationTypSupported.getSupportedTypen().contains(internetPraesentationTyp)) {
      return internetPraesentationTyp;
    }

    return InternetPraesentationTyp.KEINE; // im zweifel Keine Präsentation
  }

}
