// ReSharper disable ClassNeverInstantiated.Global
namespace AIStudio.Provider.OpenAI;
///
/// What an OpenAI-compatible provider reports a chat completion cost.
///
///
/// The number is optional because this is somebody else's JSON: the block arrives only when the
/// request asked for it, and the providers which follow the shape loosely leave fields out. Reading
/// it is one thing, believing it another -- TokenUsage.OfReported decides that.
///
/// The block states more than this, the completion and its reasoning share among it. Those are left
/// unread on purpose, for the reason given at TokenUsage: no later request carries them.
///
public sealed record ChatCompletionUsage
{
///
/// What everything sent to the model cost.
///
public int? PromptTokens { get; init; }
///
/// States what this block reports, as far as it can be believed.
///
///
/// The one way from the wire to a usage, shared by every stream line which carries this block,
/// so that what counts as believable is decided in a single place.
///
/// The usage, or TokenUsage.UNKNOWN when the block states nothing usable.
public TokenUsage ToTokenUsage() => TokenUsage.OfReported(this.PromptTokens);
}