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

import javax.annotation.Nonnull;
import javax.inject.Inject;
import javax.inject.Named;

import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.business.wahlrechtspruefung.entity.Pruefkriterium;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.wahlrechtspruefung.PruefkriteriumEditView;

@Named(PruefkriteriumDeleteAction.COMPONENT_NAME)
public class PruefkriteriumDeleteAction extends AbstractPruefkriteriumAction {

  public static final String COMPONENT_NAME = "pruefkriteriumDeleteAction";

  private static final long serialVersionUID = 1L;

  @View
  @Inject
  private transient PruefkriteriumEditView pruefkriteriumEditView;

  public PruefkriteriumDeleteAction() {
    super();
  }

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

  @Override
  public boolean isDisabledInternal(@Nonnull Pruefkriterium pruefkriterium) {
    return false;
  }

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

  @Override
  protected String doIt(Pruefkriterium pruefkriterium) {
    pruefkriteriumEditView.setEntity(pruefkriterium);

    return null;
  }

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

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

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