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

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.inject.Inject;

import de.ivu.elect.business.internet.entity.InternetPraesentationTyp;
import de.ivu.elect.business.konfiguration.control.AbstractKonfigurationInit;
import de.ivu.elect.business.konfiguration.entity.ElectKonfigurationWerte;
import de.ivu.elect.business.konfiguration.entity.Konfiguration;
import de.ivu.elect.business.konfiguration.entity.KonfigurationInitContext;

public class CorePraesentationKonfigurationInit extends AbstractKonfigurationInit {

  @Inject
  private transient InternetPreasentationTypSupported internetPreasentationTypSupported;

  public CorePraesentationKonfigurationInit() {
    super();
  }

  @Override
  protected Collection<Konfiguration> createDefaultParameters(KonfigurationInitContext konfigurationInitContext) {
    List<Konfiguration> result = new ArrayList<>();
    add(result, ElectKonfigurationWerte.PRAESENTATION_TYP, getPraesentationsTyp().name());
    return result;
  }

  protected InternetPraesentationTyp getPraesentationsTyp() {

    if (internetPreasentationTypSupported.getSupportedTypen().contains(InternetPraesentationTyp.VELOCITY_WIDGET)) {
      return InternetPraesentationTyp.VELOCITY_WIDGET;
    }

    return InternetPraesentationTyp.KEINE;
  }

}
