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

import java.util.ArrayList;
import java.util.List;

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

import de.ivu.elect.jee.presentation.menu.MenuEntry;
import de.ivu.elect.presentation.kandidatur.menu.KandidaturSearchMenuItemEntry;
import de.ivu.elect.presentation.stimmeingabe.menu.StimmeingabeImportMenuItemEntry;
import de.ivu.elect.presentation.wahl.NlBackupStatus;

@Specializes
public class NlWasWahlMainMenuEntry extends WasWahlMainMenuEntry {
  private static final long serialVersionUID = 1L;

  @Inject
  protected transient KandidaturSearchMenuItemEntry kandidaturSearchMenuItemEntry;

  @Inject
  private transient NlBackupRestoreMenuItemEntry nlBackupRestoreMenuItemEntry;

  @Inject
  private transient NlBackupStatus nlBackupStatus;

  @Inject
  protected transient StimmeingabeImportMenuItemEntry stimmeingabeImportMenuItemEntry;

  @Override
  public String getLabelKey() {
    return "wahlprozess.main.menu.item.label"; // ELECT-10265
  }

  @Override
  protected List<MenuEntry> getSubMenuEntriesSorted() {
    ArrayList<MenuEntry> result = new ArrayList<>(super.getSubMenuEntriesSorted());
    result.add(kandidaturSearchMenuItemEntry); // ELECT-10270 verstorbene markieren (nur in Phase Abschluss sichtbar)
    result.add(nlBackupRestoreMenuItemEntry);
    if (nlBackupStatus.isBackupRestoreFreigeschaltet()) {
      result.add(stimmeingabeImportMenuItemEntry);
    }
    return result;
  }
}
