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

import de.ivu.elect.business.email.entity.EmailVorlage;
import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.email.EmailVorgangVorlageTestCreateView;

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

@Named(EmailVorlageTestenAction.COMPONENT_NAME)
public class EmailVorlageTestenAction extends AbstractEmailVorlageAction {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "emailVorlageTestenAction";

  @View
  @Inject
  private EmailVorgangVorlageTestCreateView emailVorgangVorlageTestCreateView;

  public EmailVorlageTestenAction() {
    super();
  }

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

  @Override
  public boolean isDisabledInternal(@Nonnull EmailVorlage emailVorlage) {
    return false;
  }

  @Override
  protected String doIt(EmailVorlage emailVorlage) {
    return emailVorgangVorlageTestCreateView.initWithEmailVorlage(emailVorlage);
  }

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

  @Override
  public String getLabelKey() {
    return "email.vorlage.action.testen";
  }

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