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

import java.util.Collections;
import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import de.ivu.elect.business.WahlOderWahlterminApp;
import de.ivu.elect.jee.presentation.menu.MenuEntry;
import de.ivu.elect.presentation.ui.AbstractPageMenuModelBuilder;

@Named(WahlOderWahlterminPageMenu.COMPONENT_NAME)
public class WahlOderWahlterminPageMenu extends AbstractPageMenuModelBuilder {

  private static final long serialVersionUID = 1L;

  public static final String COMPONENT_NAME = "wahlOderWahlterminPageMenu";

  @Inject
  private transient WahlMainMenuEntry wahlMainMenuEntry;

  @Inject
  private transient WahlterminMainMenuEntry wahlterminMainMenuEntry;

  @Inject
  private transient WahlOderWahlterminApp wahlOderWahlterminApp;

  public WahlOderWahlterminPageMenu() {
    super();
  }

  public List<MenuEntry> getWahlOderWahlterminMenuEntriesSorted() {
    if (wahlOderWahlterminApp.isWahlApp()) {
      return wahlMainMenuEntry.getSubMenuEntriesSorted();
    }
    if (wahlOderWahlterminApp.isWahlterminApp()) {
      return wahlterminMainMenuEntry.getSubMenuEntriesSorted();
    }

    return Collections.emptyList();
  }

  @Override
  public List<MenuEntry> getMenuEntriesSorted() {
    return getWahlOderWahlterminMenuEntriesSorted();
  }
}
