
package de.ivu.elect.presentation.ui;

import java.io.Serializable;

import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

@SessionScoped
@Named("pageMenuState")
public class PageMenuState implements Serializable {

  private static final long serialVersionUID = 1L;

  private static final Long DEFAULT_WIDTH = null;

  private static final boolean DEFAULT_COLLAPSED = false;

  private Long width;

  private boolean collapsed;

  public PageMenuState() {
    super();

    this.width = DEFAULT_WIDTH;
    this.collapsed = DEFAULT_COLLAPSED;
  }

  public Long getWidth() {
    return width;
  }

  public void setWidth(Long width) {
    this.width = width;
  }

  public boolean isCollapsed() {
    return collapsed;
  }

  public void setCollapsed(boolean collapsed) {
    this.collapsed = collapsed;
  }

  public String getStyle() {
    if (width == null) {
      return "";
    }

    return "width: " + width + "px";
  }

  public String getCollapsedClass() {
    if (collapsed) {
      return "page-nav-secondary--minimized";
    }

    return "";
  }
}
