import type { Api, Model } from "./types.js";

/**
 * Return the provider-facing model identifier for outbound API payloads.
 *
 * Purpose: keep Forge's canonical model ID stable for selection, capability
 * scoring, policy, and history while allowing provider endpoints to receive a
 * deployment-specific wire model name.
 *
 * Consumer: pi-ai provider implementations when building request payloads.
 */
export function resolveWireModelId<TApi extends Api>(
	model: Model<TApi>,
): string {
	return model.wireModelId?.trim() || model.id;
}
