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

namespace MOWCPS\Common\Rest_APIs;

use WP_REST_Server;
use MOWCPS\Common\Constants\Constants;
use MOWCPS\Common\Controllers\Rest_API\Product_Sync_Audit_Rest_Controller;

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

/**
 * Class Product_Sync_Audit_APIs
 *
 * Registers all Product Sync Audit REST API controllers and routes
 */
class Product_Sync_Audit_APIs {

	/**
	 * Register all routes
	 *
	 * @return void
	 */
	public static function register_routes() {
		$controller = new Product_Sync_Audit_Rest_Controller();

		register_rest_route(
			Constants::REST_API_NAMESPACE,
			'suppliers/(?P<supplier_uuid>[a-zA-Z0-9-]+)/audit/product-sync',
			array(
				'methods'             => WP_REST_Server::READABLE,
				'callback'            => array( $controller, 'get_product_sync_audit_by_supplier' ),
				'permission_callback' => array( $controller, 'check_permissions' ),
			)
		);
	}
}
