<?php
/**
 * Canonical conversion event type constants.
 *
 * @package Carticy\Conversions\Domain
 */

declare(strict_types=1);

namespace Carticy\Conversions\Domain;

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

/**
 * Event types owned by the domain layer.
 */
final class ConversionEventType {

	public const PURCHASE = 'purchase';
	public const REFUND   = 'refund';
	public const RENEWAL  = 'renewal';

	/**
	 * Validate an event type.
	 *
	 * @param string $event_type Event type.
	 * @return bool
	 */
	public static function is_valid( string $event_type ): bool {
		return in_array( $event_type, self::values(), true );
	}

	/**
	 * Get supported event types.
	 *
	 * @return array<int, string>
	 */
	public static function values(): array {
		return array( self::PURCHASE, self::REFUND, self::RENEWAL );
	}
}
