
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;
import de.ivu.elect.presentation.security.AbstractGebietSecurity;
import de.ivu.elect.presentation.stimmzettel.action.EntityAufStimmzettelDeleteAction;

@Named(EinzelbewerberListenkandidaturDeleteAction.COMPONENT_NAME) // Cf. EinzelbewerberListeDeleteAction!!!
public class EinzelbewerberListenkandidaturDeleteAction extends AbstractEinzelbewerberListenkandidaturAction implements EntityAufStimmzettelDeleteAction<Listenkandidatur> {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "einzelbewerberListenkandidaturDeleteAction";

  @Inject
  private transient ListenkandidaturConversationSelect listenkandidaturConversationSelect;

  public EinzelbewerberListenkandidaturDeleteAction() {
    super();
  }

  @Override
  public UseCasePermission getRequiredPermission() {
    return UseCasePermission.LISTENKANDIDATUR_DELETE;
  }

  @Override
  public AbstractGebietSecurity getGebietSecurity() {
    return super.getGebietSecurity();
  }

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

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

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

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

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

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