<?php
/**
 * EditorBadge — Unified badge overlay for block editor.
 *
 * Enqueues a single HOC that reads attributes from multiple badge sources
 * (hover animation, trigger, responsive conditions) and renders one combined
 * ::before badge via CSS variable.
 */

namespace Brandy\BlockSettings\EditorBadge;

use Brandy\Traits\SingletonTrait;

class Caller {
	use SingletonTrait;

	protected function __construct() {
		add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_editor_assets' ) );
		add_action( 'enqueue_block_assets', array( $this, 'enqueue_editor_styles' ) );
	}

	public function enqueue_editor_assets() {
		wp_enqueue_script(
			'brandy/editor-badge',
			BRANDY_TEMPLATE_URL . '/inc/BlockSettings/EditorBadge/script.js',
			// Depend on responsive-conditions-helpers so window.BrandyResponsiveConditionsHelpers
			// is available; badge reads native WP 7.0 blockVisibility through it.
			array( 'wp-hooks', 'wp-compose', 'wp-element', 'brandy/responsive-conditions-helpers' ),
			BRANDY_SCRIPT_VERSION,
			true
		);
	}

	public function enqueue_editor_styles() {
		wp_enqueue_style(
			'brandy/editor-badge',
			BRANDY_TEMPLATE_URL . '/inc/BlockSettings/EditorBadge/style.css',
			array(),
			BRANDY_SCRIPT_VERSION
		);
	}
}

Caller::get_instance();
