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

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

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;

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

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "emailSendeErneutAction";

  @View
  @Inject
  private transient EmailEditView emailEditView;

  public EmailSendeErneutAction() {
    super();
  }

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

  @Override
  protected boolean isDisabledInternal(@Nonnull Email entity) {
    return false;
  }

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

    return null;
  }

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

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

  @Override
  public String getLabelKey() {
    return "email.action.sende.erneut";
  }

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