
package de.ivu.elect.presentation.kandidatur;

import java.io.Serializable;

import javax.inject.Inject;

import de.ivu.elect.business.mandant.entity.Mandant;
import de.ivu.elect.business.personenregister.boundary.PersonenregisterSwitch;

public class ListenkandidaturCreateViewResolver implements Serializable {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient PersonenregisterSwitch personenregisterSwitch;

  public ListenkandidaturCreateViewResolver() {
    super();
  }

  public String getViewId(Mandant mandant) {
    if (isPersonenregisterAvailable(mandant)) {
      return ListenkandidaturPersonenregisterPersonendatenSelectionView.VIEW_ID;
    }

    return ListenkandidaturCreateView.VIEW_ID;
  }

  private boolean isPersonenregisterAvailable(Mandant mandant) {
    return personenregisterSwitch.isPersonenregisterAvailable(mandant);
  }
}
