<?php
/**
 * @license GPL-2.0-or-later
 * @link    https://wordpress.org/plugins/pressio-crm
 */
namespace PressioCRM\Modules;

defined( 'ABSPATH' ) || exit;

use PressioCRM\Framework\Module;
use PressioCRM\API\RestSearch;

class SearchModule extends Module {

	public function register(): void {
		// No container bindings needed — search controller has no dependencies.
	}

	public function boot(): void {
		// register_rest_route() must only run on rest_api_init — calling it during
		// init boots the REST server early and fires rest_api_init before other
		// plugins' post types exist (fatals observed with LearnDash).
		add_action( 'rest_api_init', [ $this, 'register_routes' ] );
	}

	public function register_routes(): void {
		( new RestSearch() )->register_routes();
	}
}
