<?php
/**
 * Webhook interface.
 */

declare(strict_types=1);
namespace FeData\FastEvents\Hooks\Webhooks;

defined( 'ABSPATH' ) || exit;

use stdClass;

interface WebhookInterface {

	/**
	 * Dispatch the webhook to the appropriate handler.
	 *
	 * @since 1.0
	 *
	 * @param string   $dispatch If the topic is 'event.created', this arg should be 'created'.
	 * @param stdClass $webhook  Webhook data from the database.
	 * @param mixed    $arg      Identifier. Can be an event_id, order_id, or a qrcode with a level structure.
	 */
	public function dispatch( string $dispatch, stdClass $webhook, mixed $arg ): void;

	/**
	 * Set retry position.
	 *
	 * @since 3.0.0
	 *
	 * @param int $position Retry position.
	 */
	public function set_retry_position( int $position ): void;

	/**
	 * Set retry scheme.
	 *
	 * @since 3.0.0
	 *
	 * @param array $retry_scheme Retry position.
	 */
	public function set_retry_scheme( array $retry_scheme ): void;

	/**
	 * Set arguments of the webhook action.
	 *
	 * @since 3.0.0
	 *
	 * @param mixed $arg Webhook arguments.
	 */
	public function set_arg( mixed $arg ): void;
}
