<?php
/**
 * AssetsHook class.
 *
 * Hooks for loading admin and frontend assets via AssetLoader.
 *
 * @package Ilabs\Firevert\Core\Hooks
 */

declare(strict_types=1);

namespace Ilabs\Firevert\Core\Hooks;

use Ilabs\Firevert\Core\Services\Loader\AssetLoader;

/**
 * Class AssetsHook
 *
 * Registers WordPress actions to enqueue plugin assets.
 */
final class AssetsHook {

	/**
	 * Handles enqueuing of assets.
	 *
	 * @var AssetLoader
	 */
	private AssetLoader $loader;

	/**
	 * Constructor.
	 *
	 * @param AssetLoader $loader Get from DI container.
	 */
	public function __construct( AssetLoader $loader ) {
		$this->loader = $loader;
	}

	/**
	 * Registers WordPress actions for admin and frontend asset loading.
	 */
	public function register(): void {
		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend_assets' ) );
	}

	/**
	 * Enqueues admin assets.
	 */
	public function enqueue_admin_assets(): void {
		$this->loader->enqueue_admin_assets();
	}

	/**
	 * Enqueues frontend assets.
	 */
	public function enqueue_frontend_assets(): void {
		$this->loader->enqueue_frontend_assets();
	}
}
