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

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

import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.business.wahl.entity.Wahltermin;

@Named(WahlterminDeleteAction.COMPONENT_NAME)
public class WahlterminDeleteAction extends AbstractWahlterminAction {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "wahlterminDeleteAction";

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

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

  @Override
  protected String doIt(Wahltermin entity) {
    wahlterminConversationSelect.setEntity(entity);

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

  @Override
  public boolean isDisabledInternal(@Nonnull Wahltermin entity) {
    return super.isDisabledInternal(entity) || !entity.getStatus().isLoeschbar();
  }

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

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

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