<?php

namespace Fotogenic_AI;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Canonical bounds for opaque identifiers returned by the generation API.
 */
final class Upstream_Identifier {
	public const MAX_LENGTH = 255;

	/**
	 * @param mixed $value Candidate upstream identifier.
	 */
	public static function normalize( $value ): string {
		if ( ! is_string( $value ) ) {
			return '';
		}
		$value = trim( $value );
		return '' !== $value && strlen( $value ) <= self::MAX_LENGTH ? $value : '';
	}
}
