<?php
/**
 * Core module composition result.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChanges\Bootstrap;

use ScheduledChanges\Provider\ProviderManager;
use ScheduledChanges\Recording\RecordingService;
use ScheduledChanges\Rollback\EndVersionCompiler;
use ScheduledChanges\Rollback\RollbackService;
use ScheduledChanges\Scheduler\QueueMonitor;
use ScheduledChanges\Scheduler\SchedulerService;

/**
 * Exposes public services assembled from the selected module graph.
 */
final class CoreModuleServices {
	private ProviderManager $providers;
	private ?SchedulerService $scheduler;
	private ?QueueMonitor $queue;
	private ?RollbackService $rollback;
	private ?EndVersionCompiler $end_version_compiler;
	private ?RecordingService $recording;
	private ?object $notifications;
	private ?object $approvals;

	/**
	 * Creates the selected core service result.
	 */
	public function __construct(
		ProviderManager $providers,
		?SchedulerService $scheduler,
		?QueueMonitor $queue,
		?RollbackService $rollback,
		?EndVersionCompiler $end_version_compiler,
		?RecordingService $recording,
		?object $notifications = null,
		?object $approvals = null
	) {
		$this->providers            = $providers;
		$this->scheduler            = $scheduler;
		$this->queue                = $queue;
		$this->rollback             = $rollback;
		$this->end_version_compiler = $end_version_compiler;
		$this->recording            = $recording;
		$this->notifications        = $notifications;
		$this->approvals            = $approvals;
	}

	/** Returns provider discovery services. */
	public function providers(): ProviderManager {
		return $this->providers;
	}

	/** Returns scheduling when selected. */
	public function scheduler(): ?SchedulerService {
		return $this->scheduler;
	}

	/** Returns queue diagnostics when selected. */
	public function queue(): ?QueueMonitor {
		return $this->queue;
	}

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

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

	/** Returns Record Changes when selected. */
	public function recording(): ?RecordingService {
		return $this->recording;
	}

	/** Returns notification delivery when selected. */
	public function notifications(): ?object {
		return $this->notifications;
	}

	/** Returns approval workflows when selected. */
	public function approvals(): ?object {
		return $this->approvals;
	}
}
