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.gebietsbaum.menu.GebietMainMenuEntry;
import de.ivu.elect.presentation.gebietsbaum.menu.VoteValueEditMenuItemEntry;
import de.ivu.elect.presentation.gruppe.menu.GruppeMainMenuEntry;
import de.ivu.elect.presentation.security.menu.NlPublicKeyEditMenuItem;
import de.ivu.elect.presentation.security.menu.NlPublicKeyImportMenuItem;
import de.ivu.elect.presentation.stimmeingabe.menu.StimmeingabePlausiKonfigurationSearchMenuItemEntry;
import de.ivu.elect.presentation.wahlvorschlag.menu.WahlvorschlagImportMenuItemEntry;
import de.ivu.elect.presentation.wahlvorschlag.menu.WahlvorschlagSearchMenuItemEntry;

@Specializes
public class NlWasWahlprozessMainMenuEntry extends NlWahlprozessMainMenuEntry {
  private static final long serialVersionUID = 1L;

  @Inject
  protected transient GebietMainMenuEntry gebietMainMenuEntry;

  @Inject
  protected transient GruppeMainMenuEntry gruppeMainMenuEntry;

  @Inject
  private transient VoteValueEditMenuItemEntry voteValueEditMenuItemEntry;

  @Inject
  protected transient WahlvorschlagImportMenuItemEntry wahlvorschlagImportMenuItemEntry;

  @Inject
  private transient WahlvorschlagSearchMenuItemEntry wahlvorschlagSearchMenuItemEntry;

  @Inject
  private transient StimmeingabePlausiKonfigurationSearchMenuItemEntry stimmeingabePlausiKonfigurationSearchMenuItemEntry;

  @Inject
  private transient NlPublicKeyEditMenuItem nlPublicKeyEditMenuItem;

  @Inject
  private transient NlPublicKeyImportMenuItem nlPublicKeyImportMenuItem;

  @Inject
  private transient CoreWahlMainMenuEntry coreWahlMainMenuEntry;

  @Override
  protected List<MenuEntry> getSubMenuEntriesSorted() {
    List<MenuEntry> subMenuEntriesSorted = new ArrayList<>(super.getSubMenuEntriesSorted());
    subMenuEntriesSorted.add(separator);
    subMenuEntriesSorted.addAll(gebietMainMenuEntry.getSubMenuEntries());
    subMenuEntriesSorted.add(voteValueEditMenuItemEntry);
    subMenuEntriesSorted.add(separator);
    subMenuEntriesSorted.addAll(gruppeMainMenuEntry.getSubMenuEntries());
    subMenuEntriesSorted.add(separator);
    subMenuEntriesSorted.add(wahlvorschlagSearchMenuItemEntry);
    subMenuEntriesSorted.add(wahlvorschlagImportMenuItemEntry);
    subMenuEntriesSorted.add(separator);
    subMenuEntriesSorted.add(stimmeingabePlausiKonfigurationSearchMenuItemEntry);
    subMenuEntriesSorted.add(separator);
    subMenuEntriesSorted.add(nlPublicKeyEditMenuItem);
    subMenuEntriesSorted.add(nlPublicKeyImportMenuItem);

    coreWahlMainMenuEntry.addAuszuwaehlendeWahlenMenuEntries(subMenuEntriesSorted, true);

    return subMenuEntriesSorted;
  }
}
