<?php
/**
 * Event destination contract.
 *
 * @package Carticy\Conversions\Events
 */

declare(strict_types=1);

namespace Carticy\Conversions\Events;

use Carticy\Conversions\Domain\ConversionEvent;

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

/**
 * Receives canonical conversion events after an idempotency claim is acquired.
 */
interface EventDestinationInterface {

	/**
	 * Get the stable destination key used in idempotency records.
	 *
	 * @return string
	 */
	public function key(): string;

	/**
	 * Send or record an event.
	 *
	 * @param ConversionEvent $event Canonical event snapshot.
	 * @return bool True when the destination accepted the event.
	 */
	public function send( ConversionEvent $event ): bool;
}
