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

import javax.annotation.Nonnull;
import javax.enterprise.inject.Specializes;
import javax.inject.Inject;

import de.ivu.elect.business.wahl.entity.WahlParameter;
import de.ivu.elect.presentation.replikation.ReplikationPresentationStatus;

/**
 *  on 25.07.2017.
 */
@Specializes
public class WasWahlParameterEditAction extends WahlParameterEditAction {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient ReplikationPresentationStatus replikationPresentationStatus;

  @Override
  protected boolean isDisabledInternal(@Nonnull WahlParameter wahlParameter) {
    return super.isDisabledInternal(wahlParameter) || isSlave();
  }

  // WASDE-1153
  private boolean isSlave() {
    return replikationPresentationStatus.isSlave();
  }

}
