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

import de.ivu.elect.business.email.entity.Email;
import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.email.EmailEditView;

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

@Named(EmailDeleteAction.COMPONENT_NAME)
public class EmailDeleteAction extends AbstractEmailAction {

  public static final String COMPONENT_NAME = "emailDeleteAction";

  private static final long serialVersionUID = 1L;

  @View
  @Inject
  private EmailEditView emailEditView;

  public EmailDeleteAction() {
    super();
  }

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

  @Override
  public boolean isDisabledInternal(@Nonnull Email emailVorgang) {
    return false;
  }

  @Override
  protected String doIt(Email email) {
    emailEditView.setEntity(email);

    return null;
  }

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

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

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

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