<?php
/**
 * Shadow clone result.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChangesWooCommerce\CoreCompat\Recording;

/**
 * Result of cloning a source product into an isolated recording workspace.
 */
final class ShadowCloneResult {
	private int $shadow_product_id;
	/**
	 * @var array<string, mixed>
	 */
	private array $variation_map;
	/**
	 * @var array<string, mixed>
	 */
	private array $provider_map;
	/**
	 * @param array<string,mixed> $variation_map Source/shadow variation mapping.
	 * @param array<string,mixed> $provider_map Provider clone metadata.
	 */
	public function __construct(
		int $shadow_product_id,
		array $variation_map,
		array $provider_map
	) {
		$this->shadow_product_id = $shadow_product_id;
		$this->variation_map     = $variation_map;
		$this->provider_map      = $provider_map;
		if ( $this->shadow_product_id <= 0 ) {
			throw new \InvalidArgumentException( 'Shadow product ID must be positive.' );
		}
	}

	public function shadowProductId(): int {
		return $this->shadow_product_id;
	}

	/**
	 * @return array<string,mixed>
	 */
	public function variationMap(): array {
		return $this->variation_map;
	}

	/**
	 * @return array<string,mixed>
	 */
	public function providerMap(): array {
		return $this->provider_map;
	}
}
