<?php
/**
 * WooCommerce product-editor recording delivery module.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChangesWooCommerce\CoreCompat\Admin;

use ScheduledChanges\Bootstrap\CoreModuleServices;
use ScheduledChangesWooCommerce\CoreCompat\Recording\RecordingCommentGuard;
use ScheduledChanges\Repository\WpdbRecordingSessionRepository;

/**
 * Wires product-editor recording UI to selected core application contracts.
 */
final class ProductEditorRecordingModule {
	public const MODULE_ID = 'scheduled-changes-woocommerce-product-editor-recording';

	/** Registers the delivery surface when its required services are available. */
	public function register( CoreModuleServices $services ): void {
		$recording = $services->recording();
		$scheduler = $services->scheduler();

		if ( null === $recording || null === $scheduler ) {
			return;
		}

		$recordings = new WpdbRecordingSessionRepository();

		( new RecordingCommentGuard( $recordings ) )->register();
		( new ProductEditorRecordingController( $recordings, $recording, $scheduler ) )->register();
	}
}
