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

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

import de.ivu.elect.business.kandidatur.boundary.ErsatzkandidaturConversationSelect;
import de.ivu.elect.business.kandidatur.entity.Ersatzkandidatur;
import de.ivu.elect.business.security.UseCasePermission;

@Named(ErsatzkandidaturDeleteAction.COMPONENT_NAME)
public class ErsatzkandidaturDeleteAction extends AbstractErsatzkandidaturAction {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "ersatzkandidaturDeleteAction";

  @Inject
  private transient ErsatzkandidaturConversationSelect ersatzkandidaturSelect;

  public ErsatzkandidaturDeleteAction() {
    super();
  }

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

  @Override
  protected boolean isDisabledInternal(Ersatzkandidatur ersatzkandidatur) {
    return false;
  }

  @Override
  protected String doIt(Ersatzkandidatur ersatzkandidatur) {
    ersatzkandidaturSelect.setEntity(ersatzkandidatur);

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

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

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

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

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