<?php
/**
 * REST API manager.
 *
 * @package MonitorCat\Rest
 */

declare(strict_types=1);

namespace MonitorCat\Rest;

defined( 'ABSPATH' ) || exit;

use MonitorCat\Module\ModuleRegistry;

/**
 * Manages REST API endpoint registration for all modules.
 */
final class RestManager {

	/**
	 * REST API namespace.
	 *
	 * @var string
	 */
	public const NAMESPACE = 'monitor-cat/v1';

	/**
	 * Module registry.
	 *
	 * @var ModuleRegistry
	 */
	private ModuleRegistry $registry;

	/**
	 * Constructor.
	 *
	 * @param ModuleRegistry $registry Module registry.
	 */
	public function __construct( ModuleRegistry $registry ) {
		$this->registry = $registry;
	}

	/**
	 * Register all module REST API routes.
	 */
	public function register(): void {
		$this->registry->register_all_routes();
	}
}
