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

import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.wahl.WahlCreateView;

import javax.inject.Inject;

public class WahlCreateMenuItemEntry extends AbstractWahlMenuItemEntry {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient WahlCreateMenuItemEnabled wahlCreateMenuItemEnabled;

  public WahlCreateMenuItemEntry() {
    super();
  }

  @Override
  protected UseCasePermission getUseCasePermission() {
    return UseCasePermission.WAHL_CREATE;
  }

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

  @Override
  protected String getLabel() {
    return getMessage(getLabelKey(), getMeta().getEinzahlMessage());
  }

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

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

  @Override
  public boolean isDisabledInternal() {
    return super.isDisabledInternal() || !wahlCreateMenuItemEnabled.isEnabled();
  }
}
