
package de.ivu.elect.presentation.interfaces;

import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

import de.ivu.elect.business.konfiguration.entity.MandantKonfigurationWerte;
import de.ivu.elect.business.konfiguration.entity.WvpModus;
import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.hilfe.OnlineHilfeId;

@RequestScoped
@OnlineHilfeId(value = "330", mehrfachVergebenOk = true)
@Named(InterfacesStatusTestView.COMPONENT_NAME)
@View(viewId = InterfacesStatusTestView.VIEW_ID, useCase = UseCasePermission.INTERFACES_STATUS_TEST)
public class InterfacesStatusTestView extends AbstractInterfacesStatusTestView {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "interfacesStatusTestView";

  public static final String VIEW_ID = "/interfaces/interfaces-status-test.xhtml";

  public InterfacesStatusTestView() {
    super();
  }

  public boolean isStatusWvpSchnittstelleRendered() {
    WvpModus wvpModus = loadWvpModus();

    return wvpModus != null && wvpModus.isOnline() || getMandant().getArt().isSystemMandantImMandantensystem(); // ELECT-13625
  }

  private WvpModus loadWvpModus() {
    return resolveEnumValue(MandantKonfigurationWerte.WVP_MODUS, WvpModus.class);
  }
}
