<?php
defined( 'ABSPATH' ) || exit;

/**
 * REST API initializer — registers all TukiFlow endpoints.
 */
class TFDC_Api {

	/** @var self|null */
	private static $instance = null;

	/**
	 * Get the single instance.
	 *
	 * @return self
	 */
	public static function get_instance() {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self();
		}
		return self::$instance;
	}

	/**
	 * Constructor.
	 */
	private function __construct() {
		add_action( 'rest_api_init', array( $this, 'register_routes' ) );
	}

	/**
	 * Register all REST routes.
	 */
	public function register_routes() {
		$controllers = array(
			new TFDC_Endpoint_Settings(),
			new TFDC_Endpoint_Landing_Pages(),
		);

		foreach ( $controllers as $controller ) {
			$controller->register_routes();
		}
	}
}
