<?php
/**
 * Audit and operational diagnostics module boundary.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChanges\Audit;

use ScheduledChanges\Repository\AuditRepository;
use ScheduledChanges\Repository\RunRepository;
use ScheduledChanges\Repository\WpdbAuditRepository;
use ScheduledChanges\Repository\WpdbRunRepository;

/**
 * Builds durable operational evidence services selected by the active module graph.
 */
final class AuditDiagnosticsModule {
	public const MODULE_ID = 'scheduled-changes-audit-diagnostics';

	/**
	 * Creates the shared run, audit, and redaction services.
	 */
	public function createServices(
		?RunRepository $runs = null,
		?AuditRepository $audit = null,
		?AuditRedactor $redactor = null
	): AuditDiagnosticsServices {
		$redactor ??= new AuditRedactor();
		$runs     ??= new WpdbRunRepository();
		$audit    ??= new WpdbAuditRepository( null, null, $redactor );

		return new AuditDiagnosticsServices( $runs, $audit, $redactor );
	}
}
