
package de.ivu.elect.presentation;

import java.util.List;

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

import de.ivu.elect.business.wahllokalsystem.control.WahllokalsystemAktiv;
import de.ivu.elect.jee.presentation.menu.MenuEntry;
import de.ivu.elect.presentation.ergebnis.menu.WasErgebnisMainMenuEntry;
import de.ivu.elect.presentation.gruppe.menu.GruppeMainMenuEntry;
import de.ivu.elect.presentation.menu.ElectCommonMainMenu;
import de.ivu.elect.presentation.niederschrift.menu.NiederschriftMainMenuEntry;
import de.ivu.elect.presentation.praesentation.menu.PraesentationMainMenuEntry;
import de.ivu.elect.presentation.stimmeingabe.menu.StimmenMainMenuEntry;
import de.ivu.elect.presentation.wahl.menu.WahlMainMenuEntry;
import de.ivu.elect.presentation.wahlausschuss.menu.WahlausschussMainMenuEntry;
import de.ivu.elect.presentation.wahlbeteiligung.menu.WahlbeteiligungMainMenuEntry;
import de.ivu.elect.presentation.wahllokalsystem.menu.WahllokalsystemMainMenuEntry;
import de.ivu.elect.presentation.wahlvorschlag.menu.WahlvorschlagMainMenuEntry;

@Specializes
public class WasMainMenu extends ElectCommonMainMenu {

  private static final long serialVersionUID = 1L;

  @Inject
  protected transient WahlMainMenuEntry wahlMainMenuEntry;

  @Inject
  protected transient GruppeMainMenuEntry gruppeMainMenuEntry;

  @Inject
  protected transient WahlvorschlagMainMenuEntry wahlvorschlagMainMenuEntry;

  @Inject
  private transient WahlbeteiligungMainMenuEntry wahlbeteiligungMainMenuEntry;

  @Inject
  private transient WahllokalsystemMainMenuEntry wahllokalsystemMainMenuEntry;

  @Inject
  protected transient StimmenMainMenuEntry stimmenMainMenuEntry;

  @Inject
  protected transient WasErgebnisMainMenuEntry wasErgebnisMainMenuEntry;

  @Inject
  protected transient PraesentationMainMenuEntry praesentationMainMenuEntry;

  @Inject
  private transient NiederschriftMainMenuEntry niederschriftMainMenuEntry;

  @Inject
  private transient WahlausschussMainMenuEntry wahlausschussMainMenuEntry;

  @Inject
  private transient WahllokalsystemAktiv wahllokalsystemAktiv;

  public WasMainMenu() {
    super();
  }

  @Override
  public List<MenuEntry> getMenuEntriesSorted() {
    List<MenuEntry> result = super.getMenuEntriesSorted();

    result.add(result.indexOf(startViewMenuItemEntry) + 1, wahlMainMenuEntry);
    result.add(result.indexOf(gebietMainMenuEntry) + 1, gruppeMainMenuEntry);
    result.add(result.indexOf(gruppeMainMenuEntry) + 1, wahlvorschlagMainMenuEntry);
    result.add(result.indexOf(wahlvorschlagMainMenuEntry) + 1, wahlbeteiligungMainMenuEntry);
    result.add(result.indexOf(wahlbeteiligungMainMenuEntry) + 1, stimmenMainMenuEntry);
    result.add(result.indexOf(stimmenMainMenuEntry) + 1, wasErgebnisMainMenuEntry);
    result.add(result.indexOf(wasErgebnisMainMenuEntry) + 1, praesentationMainMenuEntry);
    result.add(result.indexOf(praesentationMainMenuEntry) + 1, niederschriftMainMenuEntry);
    result.add(result.indexOf(niederschriftMainMenuEntry) + 1, wahlausschussMainMenuEntry);
    if (wahllokalsystemAktiv.isAktiv()) {
      result.add(result.indexOf(wahlausschussMainMenuEntry) + 1, wahllokalsystemMainMenuEntry);
    }

    return result;
  }
}
