<?php
/**
 * A class to delete an order after the timeout period has passed.
 *
 * @since 3.0.0
 */

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

defined( 'ABSPATH' ) || exit;

use FeData\FastEvents\Helpers\OrderHelper;

/**
 * A class to delete an order after the timeout period has passed.
 */
final class ConfirmationTimeoutAction {

	/**
	 * ConfirmationTimeoutAction constructor.
	 *
	 * @since 3.0.0
	 *
	 * @param OrderHelper $order_helper Order helper.
	 */
	public function __construct( private readonly OrderHelper $order_helper ) {
	}


	/**
	 * Delete order after the timeout period has passed (Used together with the 'confirmation_emails_needed' flag in the event).
	 *
	 * @since 1.0
	 *
	 * @param int $order_id Order identifier.
	 */
	public function confirmation_timeout( int $order_id ): void {
		$this->order_helper->order_delete( $order_id );
	}
}
