<?php
/**
 * Amazon Authorization Hooks
 *
 * Registers WordPress hooks for Amazon authorization flows and delegates
 * handling to the `Amazon_Auth_Controller`.
 *
 * @package    MOMCS_Sync
 * @subpackage MOMCS_Sync/includes/common/hooks
 * @author     miniOrange
 */

declare(strict_types=1);

namespace MOMCS_Sync\Includes\Common\Hooks;

use MOMCS_Sync\Includes\Common\Controllers\Authorization\Amazon_Auth_Controller;

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

/**
 * Class Amazon_Auth_Hooks
 *
 * Wires WordPress hooks to `Amazon_Auth_Controller` methods.
 */
class Amazon_Auth_Hooks {
	/**
	 * Constructor.
	 */
	public function __construct() {
		$this->register_hooks();
	}

	/**
	 * Register WordPress hooks for Amazon authorization.
	 *
	 * @return void
	 */
	private function register_hooks(): void {
		// Admin AJAX endpoints.
		add_action( 'wp_ajax_momcs_sync_authorize', array( Amazon_Auth_Controller::class, 'handle_authorize_request' ) );
		// Front-door callback via init for OAuth redirect handling.
		add_action( 'init', array( Amazon_Auth_Controller::class, 'handle_oauth_callback' ) );
	}
}
