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

import static java.util.Collections.singletonList;

import java.util.List;

import de.ivu.elect.business.mandant.entity.Mandant;
import de.ivu.elect.presentation.menu.AbstractMenuItemEntry;
import de.ivu.elect.presentation.security.AbstractGebietSecurity;

public abstract class AbstractDirektkandidaturCreateMenuItemEntry extends AbstractMenuItemEntry {

  private static final long serialVersionUID = 1L;

  public AbstractDirektkandidaturCreateMenuItemEntry() {
    super();
  }

  @Override
  public boolean isDisabledInternal() {
    return !isGebietSelected();
  }

  @Override
  protected AbstractGebietSecurity getGebietSecurity() {
    return getBearbeitenGebietSecurity();
  }

  @Override
  public String getTargetViewId() {
    return getViewId(getMandant());
  }

  protected abstract String getViewId(Mandant mandant);

  @Override
  protected List<String> getAdditionalTopicViewIds() {
    return singletonList(getViewId(getMandant()));
  }

  @Override
  protected String getLabel() {
    return getMessage(getLabelKey(), getMessage(getEntityEinzahlMessageKey()));
  }

  protected abstract String getEntityEinzahlMessageKey();

  @Override
  public String getLabelKey() {
    return "entity.create.menu.item.label";
  }

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