<?php
/**
 * Execution module service bundle.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChanges\Execution;

use ScheduledChanges\Snapshot\SnapshotCoordinator;

use ScheduledChanges\Lock\LockManager;

/**
 * Holds services created by the execution module.
 */
final class ExecutionServices {
	private LockManager $locks;
	private SnapshotCoordinator $snapshots;
	/**
	 * @var ProviderOperationHandler[]
	 */
	private array $operation_handlers;
	private ExecutionEngine $engine;

	/**
	 * @param ProviderOperationHandler[] $operation_handlers Provider operation handlers.
	 */
	public function __construct(
		LockManager $locks,
		SnapshotCoordinator $snapshots,
		array $operation_handlers,
		ExecutionEngine $engine
	) {
		$this->locks              = $locks;
		$this->snapshots          = $snapshots;
		$this->operation_handlers = $operation_handlers;
		$this->engine             = $engine;
	}

	public function locks(): LockManager {
		return $this->locks;
	}

	public function snapshots(): SnapshotCoordinator {
		return $this->snapshots;
	}

	/**
	 * @return ProviderOperationHandler[]
	 */
	public function operationHandlers(): array {
		return $this->operation_handlers;
	}

	public function engine(): ExecutionEngine {
		return $this->engine;
	}
}
