
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(EmailVorlageDeleteAction.COMPONENT_NAME)
public class EmailVorlageDeleteAction extends AbstractEmailVorlageAction {

  public static final String COMPONENT_NAME = "emailVorlageDeleteAction";

  private static final long serialVersionUID = 1L;

  @View
  @Inject
  private EmailVorlageEditView emailVorlageEditView;

  public EmailVorlageDeleteAction() {
    super();
  }

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

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

  @Override
  protected String doIt(EmailVorlage emailLayout) {
    emailVorlageEditView.setEntity(emailLayout);

    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();
  }
}
