<?php
/**
 * Placeholder.
 *
 * @package MadeByAura\Prime\Customizer\Fields\Forms
 * @author  MadeByAura.com
 */

namespace MadeByAura\Prime\Customizer\Fields\Forms;

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

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

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

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

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

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

		// Color.
		$id       = 'color';
		$priority = Add::field(
			$section,
			$id,
			$priority,
			[
				'label'     => esc_attr__( 'Color', 'aura-prime' ),
				'type'      => 'color',
				'default'   => Value::get_default( $section, $id ),
				'transport' => 'auto',
				'choices'   => [
					'alpha' => true,
				],
				'output'    => [
					[
						'element'  => ':root',
						'property' => '--aura-g-placeholder-color',
					],
				],
			],
		);

		// Font style.
		$id       = 'font_style';
		$priority = Add::field(
			$section,
			$id,
			$priority,
			[
				'label'     => esc_attr__( 'Font style', 'aura-prime' ),
				'type'      => 'select',
				'default'   => Value::get_default( $section, $id ),
				'transport' => 'auto',
				'choices'   => [
					'inherit' => esc_attr__( 'Inherit', 'aura-prime' ),
					'normal'  => esc_attr__( 'Normal', 'aura-prime' ),
					'italic'  => esc_attr__( 'Italic', 'aura-prime' ),
					'oblique' => esc_attr__( 'Oblique', 'aura-prime' ),
				],
				'output'    => [
					[
						'element'  => ':root',
						'property' => '--aura-g-placeholder-font-style',
					],
				],
			],
		);
	}
}
