<?php
/**
 * Created target rollback handler contract.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChanges\Rollback;

use ScheduledChanges\Domain\Operation\Operation;
use ScheduledChanges\Execution\ExecutionState;

/**
 * Provider-owned rollback behavior for targets created by an operation.
 */
interface CreatedTargetRollbackHandler {
	public function supportsCreatedTarget( Operation $operation ): bool;

	/**
	 * @param array<string,array<string,mixed>> $source_results Source operation results.
	 */
	public function registerCreatedTarget( Operation $operation, array $source_results, ExecutionState $state ): void;

	/**
	 * @param array<string,array<string,mixed>> $source_results Source operation results.
	 * @return array<string,mixed>
	 */
	public function rollbackCreatedTarget( Operation $operation, array $source_results, string $policy ): array;
}
