<?php
/**
 * Links.
 *
 * @package MadeByAura\Prime\Customizer\Fields\Content
 * @author  MadeByAura.com
 */

namespace MadeByAura\Prime\Customizer\Fields\Content;

use MadeByAura\Prime\Customizer\Modules\Add;
use MadeByAura\Prime\Customizer\Modules\Value;
use MadeByAura\Prime\Helpers\SingletonTrait;

defined( 'ABSPATH' ) || die();

/**
 * Links.
 */
class Links {
	use SingletonTrait;

	/**
	 * Constructor.
	 */
	protected function __construct() {
		add_action( 'after_setup_theme', [ __CLASS__, 'add_section' ] );
	}

	/**
	 * Add section.
	 */
	public static function add_section() {
		$section  = 'content_links';
		$priority = 10;

		// Section.
		Add::section(
			$section,
			[
				'title'    => esc_attr__( 'Links', 'aura-prime' ),
				'section'  => 'aura_section_content',
				'priority' => 0,
			],
		);

		// Underline.
		$id       = 'underline';
		$priority = Add::field(
			$section,
			$id,
			$priority,
			[
				'label'   => esc_attr__( 'Underline', 'aura-prime' ),
				'type'    => 'checkbox',
				'default' => Value::get_default( $section, $id ),
				'output'  => [
					[
						'element'       => '.aura-formatted-content :where(a)',
						'property'      => 'text-decoration',
						'value_pattern' => 'underline',
						'exclude'       => [ false ],
					],
				],
			],
		);
	}
}
