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

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "emailLayoutEditAction";

  @View
  @Inject
  private EmailLayoutEditView emailLayoutEditView;

  public EmailLayoutEditAction() {
    super();
  }

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

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

  @Override
  protected String doIt(EmailLayout emailLayout) {
    return emailLayoutEditView.edit(emailLayout);
  }

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

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

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