<?php
/**
 * Custom Site Header Colour Class
 *
 * @package errigal
 * @since 1.0.0
 */

namespace Errigal\Customiser;

defined( 'ABSPATH' ) || exit;

use Errigal\Constant\Errigal_Header_Class as Header_Class;
use Errigal\Shared\{
	Errigal_Utility as Utility,
	Errigal_Validator as Validator,
};

/**
 * This class is in charge of providing site header colour settings and functions.
 *
 * @since 1.0.0
 */
class Errigal_Custom_Site_Header_Colour extends Errigal_Custom_Base {
	/**
	 * Setting ID: Site header colour.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	public const ID_SITE_HEADER_COLOUR = 'site_header_colour';

	/**
	 * Site header colour value: Light.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	public const SITE_HEADER_COLOUR_LIGHT = 'light';

	/**
	 * Site header colour value: Dark.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	public const SITE_HEADER_COLOUR_DARK = 'dark';

	/**
	 * Site header colour value: Stripes.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	public const SITE_HEADER_COLOUR_STRIPES = 'stripes';

	/**
	 * Default setting value: Site header colour.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	public const DEFAULT_SITE_HEADER_COLOUR = self::SITE_HEADER_COLOUR_LIGHT;

	/**
	 * Gets site header colour class.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public static function get_site_header_colour_class() {
		$site_header_colour = self::get_theme_mod_string(
			self::ID_SITE_HEADER_COLOUR,
			self::DEFAULT_SITE_HEADER_COLOUR
		);

		if ( ! Validator::is_non_empty_string( $site_header_colour ) ) {
			return '';
		}

		return Utility::get_class(
			Utility::join(
				Utility::SEPARATOR_HYPHEN,
				Header_Class::SITE_HEADER,
				sanitize_title( $site_header_colour )
			)
		);
	}
}
