<?php
/**
 * Public procedural API for MenuVerse.
 *
 * @package MenuVerse
 */

defined( 'ABSPATH' ) || exit;

if ( ! function_exists( 'menuverse_register_module' ) ) {
	/**
	 * Registers a module class with the plugin registry.
	 *
	 * Call during the `menuverse_register_modules` action.
	 *
	 * @param string $class_name Fully qualified class implementing the module interface.
	 * @return bool True when the module was registered.
	 */
	function menuverse_register_module( $class_name ) {
		return \WPXero\MenuVerse\Plugin::instance()->modules()->register( $class_name );
	}
}

if ( ! function_exists( 'menuverse_capability' ) ) {
	/**
	 * Returns the capability required to manage MenuVerse.
	 *
	 * @return string
	 */
	function menuverse_capability() {
		return \WPXero\MenuVerse\Capabilities::manage();
	}
}

if ( ! function_exists( 'menuverse_get_settings' ) ) {
	/**
	 * Returns the full settings tree, merged over defaults.
	 *
	 * @return array
	 */
	function menuverse_get_settings() {
		return \WPXero\MenuVerse\Plugin::instance()->settings()->all();
	}
}

if ( ! function_exists( 'menuverse_get_module_settings' ) ) {
	/**
	 * Returns the stored settings for a single module.
	 *
	 * @param string $module_id Module identifier.
	 * @return array
	 */
	function menuverse_get_module_settings( $module_id ) {
		return \WPXero\MenuVerse\Plugin::instance()->settings()->get_module( $module_id );
	}
}

if ( ! function_exists( 'menuverse_is_pro' ) ) {
	/**
	 * Reports whether MenuVerse Pro is active on this site.
	 *
	 * Themes and extensions asking this get the same answer the render path
	 * uses, so an add on cannot come to a different conclusion than the plugin.
	 *
	 * @return bool
	 */
	function menuverse_is_pro() {
		return \WPXero\MenuVerse\Pro::is_active();
	}
}

if ( ! function_exists( 'menuverse_is_module_enabled' ) ) {
	/**
	 * Determines whether a module is enabled.
	 *
	 * @param string $module_id Module identifier.
	 * @return bool
	 */
	function menuverse_is_module_enabled( $module_id ) {
		return \WPXero\MenuVerse\Plugin::instance()->modules()->is_enabled( $module_id );
	}
}
