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

import de.ivu.elect.business.email.entity.EmailLayout;
import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.email.EmailLayoutEditView;

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

@Named(EmailLayoutDeleteAction.COMPONENT_NAME)
public class EmailLayoutDeleteAction extends AbstractEmailLayoutAction {

  public static final String COMPONENT_NAME = "emailLayoutDeleteAction";

  private static final long serialVersionUID = 1L;

  @View
  @Inject
  private EmailLayoutEditView emailLayoutEditView;

  public EmailLayoutDeleteAction() {
    super();
  }

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

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

  @Override
  protected String doIt(EmailLayout emailLayout) {
    emailLayoutEditView.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();
  }
}
