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

import de.ivu.elect.business.email.entity.EmailVorgang;
import de.ivu.elect.business.security.UseCasePermission;
import de.ivu.elect.presentation.View;
import de.ivu.elect.presentation.email.EmailSearchView;

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

@Named(EmailVorgangEmpfaengerAnzeigenAction.COMPONENT_NAME)
public class EmailVorgangEmpfaengerAnzeigenAction extends AbstractEmailVorgangAction {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "emailVorgangEmpfaengerAnzeigenAction";

  @View
  @Inject
  private EmailSearchView emailSearchView;

  public EmailVorgangEmpfaengerAnzeigenAction() {
    super();
  }

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

  @Override
  public boolean isDisabledInternal(@Nonnull EmailVorgang emailVorgang) {
    return false;
  }

  @Override
  protected String doIt(EmailVorgang emailVorgang) {
    return emailSearchView.initWithEmailVorgang(emailVorgang);
  }

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

  @Override
  public String getLabelKey() {
    return "email.vorgang.action.empfaenger.anzeigen";
  }

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