<?php
/**
 * Shared diagnostics-label admin formatting.
 *
 * @package ScheduledChanges
 */

namespace ScheduledChanges\Repository;

// phpcs:disable Squiz.Commenting.FunctionComment.ParamCommentFullStop -- Compact forwarding annotations document the facade surface inline.

/** Formats shared text, owner, and canonical-reference values. */
final class AdminDiagnosticsDisplayFormatter {
	private AdminDashboardValueFormatter $values;

	/** @param AdminDashboardValueFormatter $values Shared value formatter. */
	public function __construct( AdminDashboardValueFormatter $values ) {
		$this->values = $values;
	}

	/** @param mixed $value Value to format. */
	public function displayText( $value ): string {
		return $this->values->displayText( $value );
	}

	/** @param int $user_id User ID. */
	public function ownerName( int $user_id ): string {
		return $this->values->ownerName( $user_id );
	}

	/**
	 * Extracts an integer ID from a canonical reference.
	 *
	 * @param string $reference Canonical reference.
	 * @param int    $fallback Fallback ID.
	 */
	public function referenceId( string $reference, int $fallback = 0 ): int {
		return $this->values->referenceId( $reference, $fallback );
	}
}
