<?php

namespace Storeplugin\PDFInvoice;

/**
 * Global helper functions for the plugin.
 *
 * @package Storeplugin\PDFInvoice
 * @since 1.0.0
 */

defined('ABSPATH') || exit;

use Storeplugin\PDFInvoice\Framework\Utils\Utils;

if (!function_exists(__NAMESPACE__ . '\\getOption')) {
	/**
	 * Get a plugin option.
	 *
	 * @param string $key     Option key.
	 * @param string $group   Option group key.
	 * @param mixed  $default Default value.
	 * @return mixed Option value.
	 */
	function getOption($key, $group, $default = false)
	{
		return Utils::getOption($key, $group, $default);
	}
}

if (!function_exists(__NAMESPACE__ . '\\updateOption')) {
	/**
	 * Update a plugin option.
	 *
	 * @param string $key   Option key.
	 * @param mixed  $value Option value.
	 * @param string $group Option group key.
	 * @return bool True on success, false on failure.
	 */
	function updateOption($key, $value, $group)
	{
		return Utils::updateOption($key, $value, $group);
	}
}

if (!function_exists(__NAMESPACE__ . '\\deleteOption')) {
	/**
	 * Delete a plugin option.
	 *
	 * @param string $key   Option key.
	 * @param string $group Option group key.
	 * @return bool True on success, false on failure.
	 */
	function deleteOption($key, $group)
	{
		return Utils::deleteOption($key, $group);
	}
}

if (!function_exists(__NAMESPACE__ . '\\getOptions')) {
	/**
	 * Get full options for a group.
	 *
	 * @param string $group Option group key.
	 * @return array Group options.
	 */
	function getOptions($group)
	{
		return Utils::getOptions($group);
	}
}

if (!function_exists(__NAMESPACE__ . '\\getAllOptions')) {
	/**
	 * Get options for all registered settings groups.
	 *
	 * @return array<string, array>
	 */
	function getAllOptions()
	{
		return Utils::getAllOptions();
	}
}

if (!function_exists(__NAMESPACE__ . '\\getOptionGroups')) {
	/**
	 * Get all registered settings option groups.
	 *
	 * @return array<int, string>
	 */
	function getOptionGroups()
	{
		return Utils::getOptionGroups();
	}
}
