<?php
/**
 * Selected rollback services.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChanges\Bootstrap;

use ScheduledChanges\Rollback\EndVersionCompiler;
use ScheduledChanges\Rollback\RollbackService;

/**
 * Carries rollback services created from the resolved module graph.
 */
final class CoreRollbackRuntime {
	private ?RollbackService $service;
	private ?EndVersionCompiler $end_version_compiler;

	/**
	 * Creates the selected rollback runtime.
	 */
	public function __construct( ?RollbackService $service, ?EndVersionCompiler $end_version_compiler ) {
		$this->service              = $service;
		$this->end_version_compiler = $end_version_compiler;
	}

	/**
	 * Returns rollback when selected and executable.
	 */
	public function service(): ?RollbackService {
		return $this->service;
	}

	/**
	 * Returns end-version compilation when rollback is selected.
	 */
	public function endVersionCompiler(): ?EndVersionCompiler {
		return $this->end_version_compiler;
	}
}
