
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.EmailVorlageEditView;

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

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

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "emailVorlageEditAction";

  @View
  @Inject
  private EmailVorlageEditView emailVorlageEditView;

  public EmailVorlageEditAction() {
    super();
  }

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

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

  @Override
  protected String doIt(EmailVorlage emailVorlage) {
    return emailVorlageEditView.edit(emailVorlage);
  }

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

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

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