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.Wahl;
import de.ivu.elect.presentation.replikation.ReplikationPresentationStatus;

/**
 *  on 25.07.2017.
 */
@Specializes
public class WasWahlDeleteAction extends WahlDeleteAction {

  private static final long serialVersionUID = 1L;

  @Inject
  private transient ReplikationPresentationStatus replikationPresentationStatus;

  @Override
  public boolean isDisabledInternal(@Nonnull Wahl wahl) {
    return super.isDisabledInternal(wahl) || isSlave();
  }

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

}
