package de.ivu.elect.presentation.security.menu;

import javax.annotation.Nullable;
import javax.inject.Inject;

import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.business.security.boundary.EmlSignKeyService;
import de.ivu.elect.business.wahl.boundary.WahlSessionSelect;
import de.ivu.elect.presentation.menu.AbstractMenuItemEntry;
import de.ivu.elect.presentation.security.AbstractGebietSecurity;
import de.ivu.elect.presentation.security.NlPrivatePublicKeyNeeded;
import de.ivu.elect.presentation.security.NlPublicKeyEditView;
import de.ivu.elect.presentation.security.NlPublicKeyImportView;

public class NlPublicKeyImportMenuItem extends AbstractMenuItemEntry {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient NlPrivatePublicKeyNeeded nlPrivatePublicKeyNeeded;

  @Inject
  private transient WahlSessionSelect wahlSessionSelect;


  @Override
  protected boolean isDisabledInternal() {
    return !wahlSessionSelect.isSelected();
  }

  @Override
  protected AbstractGebietSecurity getGebietSecurity() {
    return AbstractGebietSecurity.KEINE_GEBIET_SECURITY;
  }

  @Nullable
  @Override
  public String getTargetViewId() {
    return NlPublicKeyImportView.VIEW_ID;
  }

  @Override
  public boolean isRendered() {
    return false /*ELECTVAPP-1031*/ && hasUseCasePermission(UseCasePermission.CUSTOMER_1) && nlPrivatePublicKeyNeeded.isPublicKeyNeeded(getMandant());
  }

  @Override
  public String getLabelKey() {
    return "eml.public.key.import.menu.item";
  }

  @Override
  public String getIcon() {
    return getIcons().getIconImport();
  }
}
