<?php

namespace Engine\Menu\Structure;

// TODO: cache the menu content (into session - use basic cache class)
// TODO: should have abstract methods for loading the menu

class MenuAbstract {

	/**
	 * Menu structure starting with a root section
	 * @var \Engine\Menu\Structure\Section
	 */
	protected $structure;

	/**
	 * Display notifications menu
	 * @var Bool
	 */
	protected $hasNotifications=false;

	/**
	 * Internal options
	 * @var array
	 */
	protected $options = [];

	/**
	 * Get menu structure
	 * @return \Engine\Menu\Structure\Section
	 */
	public function getStructure() {
		return $this->structure;
	}

	/**
	 * Set notifications support
	 * @param Boolean $notifications
	 */
	public function setNotificationsSupport($notifications)
	{
		$this->hasNotifications = $notifications;
		return $this;
	}

	/**
	 *	Has notifications support
	 * 	@return Boolean
	 */
	public function hasNotificationsSupport()
	{
		return $this->hasNotifications;
	}

	/**
	 * Set an internal option
	 * @param string $key
	 * @param mixed $value
	 * @return \Engine\Menu\Structure\MenuAbstract
	 */
	public function setOption($key, $value)
	{
		$this->options[$key] = $value;
		return $this;
	}

	/**
	 * Get an internal option
	 * @param string $key
	 * @return mixed
	 */
	public function getOption($key)
	{
		return $this->options[$key];
	}
}
