<?php
/**
 * REST API Hook
 *
 * @category   WordPress_Plugin
 * @package    Common
 * @subpackage Hooks
 * @author     miniOrange <info@miniorange.com>
 * @license    MIT/Expat
 * @link       https://plugins.miniorange.com/woocommerce-api-product-sync-with-woocommerce-rest-apis
 */

namespace MOWCPS\Common\Hooks;

use MOWCPS\Common\Constants\Constants;
use MOWCPS\Common\Rest_APIs\Rest_APIs;
use MOWCPS\Common\Interfaces\Hookable_Interface;

if ( ! defined( 'ABSPATH' ) ) {
	die;
}

/**
 * Class Rest_API
 *
 * Registers REST API initialization hook
 */
class Rest_API implements Hookable_Interface {
	/**
	 * Initialize the REST API hooks
	 */
	public function __construct() {
		$this->register_hooks();
	}

	/**
	 * Register hooks
	 *
	 * @return void
	 */
	public function register_hooks() {
		$plan = false !== strpos( Constants::MOWCPS_PLAN_NAME, 'standard' ) ? 'Standard' : 'Premium';

		$rest_apis = 'MOWCPS\\' . $plan . '\\Rest_APIs\\Rest_APIs';
		add_action( 'rest_api_init', array( $rest_apis, 'register_routes' ) );
	}
}

// Initialize the Rest_API class.
new Rest_API();
