<?php
/**
 * Whitelisted preset CSS/JS assets for server-side export (free tier).
 *
 * Advanced preset styles are provided by the pro/ folder via oppb_preset_assets filter.
 *
 * @package OpusPriceBuilder\Export
 */

declare(strict_types=1);

namespace OpusPriceBuilder\Export;

/**
 * Provides trusted preset assets keyed by preset ID (free presets only).
 */
class PresetAssets {

	/**
	 * @var array<string, array{css: string, js: string, html: string|null}>
	 */
	private const PRESETS = array();

	/**
	 * Get whitelisted assets for a preset ID.
	 *
	 * @param string $preset_id Preset identifier from canvas_data.
	 * @return array{css: string, js: string, html: string|null}|null
	 */
	public static function get( string $preset_id ): ?array {
		$preset_id = sanitize_key( $preset_id );

		if ( '' === $preset_id || ! isset( self::PRESETS[ $preset_id ] ) ) {
			return null;
		}

		return self::PRESETS[ $preset_id ];
	}
}
