<?php
/**
 * Trends Filter Hook
 *
 * @category   WordPress_Plugin
 * @package    Common
 * @subpackage Hooks
 * @author     miniOrange <info@miniorange.com>
 * @license    miniOrange https://miniorange.com/usecases/miniORange_User_Agreement.pdf
 * @link       https://plugins.miniorange.com/woocommerce-api-product-sync-with-woocommerce-rest-apis
 */

namespace MOWCPS\Common\Hooks;

use MOWCPS\Common\Constants\Plugin_Filters;
use MOWCPS\Common\Interfaces\Hookable_Interface;
use MOWCPS\Common\Suppliers\Trends as Trends_Supplier;

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

/**
 * Class Trends
 *
 * Handles Trends filter hook registration
 */
class Trends implements Hookable_Interface {

	/**
	 * Initialize the Trends filter hooks.
	 */
	public function __construct() {
		$this->register_hooks();
	}

	/**
	 * Register WordPress hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_filter( Plugin_Filters::FILTER_DATA_ALTERATION_FILTER, array( Trends_Supplier::class, 'filter_empty_variations' ), 10, 1 );
		add_filter( Plugin_Filters::FILTER_DATA_ALTERATION_FILTER, array( Trends_Supplier::class, 'transform_product_data' ), 10, 1 );
		add_action( Plugin_Filters::FILTER_PERFORM_ACTION_BEFORE_SYNC, array( Trends_Supplier::class, 'sync_categories' ), 10, 1 );
		add_filter( Plugin_Filters::FILTER_UPDATE_PRO_PRODUCT, array( Trends_Supplier::class, 'set_stock_status_by_connection' ), 5, 3 );
		add_filter( Plugin_Filters::FILTER_PRODUCT_SAVE_FILTER, array( Trends_Supplier::class, 'set_stock_status_by_connection_for_save' ), 5, 3 );
	}
}
