<?php
/**
 * Recording plan draft.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChanges\Application;

use ScheduledChanges\Domain\Operation\OperationGraph;

/**
 * Provider-owned operation graph output before validation and persistence.
 */
final class RecordingPlanDraft {
	private OperationGraph $graph;
	private int $selected_change_count;
	/**
	 * @var array<string,mixed>
	 */
	private array $compatibility;
	/**
	 * @var array<string,string>
	 */
	private array $fingerprints;

	/**
	 * @param array<string,mixed>  $compatibility Runtime compatibility metadata.
	 * @param array<string,string> $fingerprints Target baseline fingerprints.
	 */
	public function __construct( OperationGraph $graph, int $selected_change_count, array $compatibility, array $fingerprints = array() ) {
		if ( $selected_change_count <= 0 ) {
			throw new \InvalidArgumentException( 'Compiled recording drafts require selected changes.' );
		}

		$this->graph                 = $graph;
		$this->selected_change_count = $selected_change_count;
		$this->compatibility         = $compatibility;
		$this->fingerprints          = $fingerprints;
	}

	/**
	 * Returns the operation graph draft.
	 */
	public function graph(): OperationGraph {
		return $this->graph;
	}

	/**
	 * Returns the selected change count represented by the graph.
	 */
	public function selectedChangeCount(): int {
		return $this->selected_change_count;
	}

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

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