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

import javax.inject.Inject;
import javax.inject.Named;

import de.ivu.elect.business.kandidatur.boundary.ListenkandidaturConversationSelect;
import de.ivu.elect.business.kandidatur.entity.Listenkandidatur;
import de.ivu.elect.business.security.UseCasePermission;

@Named(WaehlerBenannteListenkandidaturDeleteAction.COMPONENT_NAME)
public class WaehlerBenannteListenkandidaturDeleteAction extends AbstractListenkandidaturAction {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "waehlerBenannteListenkandidaturDeleteAction";

  @Inject
  private transient ListenkandidaturConversationSelect listenkandidaturConversationSelect;

  public WaehlerBenannteListenkandidaturDeleteAction() {
    super();
  }

  @Override
  protected UseCasePermission getRequiredPermission() {
    return UseCasePermission.WAEHLER_BENANNTE_KANDIDATUR_DELETE;
  }

  @Override
  protected boolean isDisabledInternal(Listenkandidatur listenkandidatur) {
    return !isWaehlerBenannteListenkandidatur(listenkandidatur);
  }

  @Override
  protected String doIt(Listenkandidatur entity) {
    listenkandidaturConversationSelect.setEntity(entity);

    // Return to current page and display the dialog!
    return null;
  }

  @Override
  public String getDialogName() {
    return "WaehlerBenannteListenkandidaturDeleteConfirm";
  }

  @Override
  protected boolean isFireChangeEvent() {
    return true;
  }

  @Override
  public String getLabelKey() {
    return "entity.edit.action.delete";
  }

  @Override
  public String getIcon() {
    return appIcons.getIconDelete();
  }
}
