using DeepDrftContent.FileDatabase.Models;
using DeepDrftModels.Enums;
namespace DeepDrftContent.Processors.Opus;
///
/// The outcome of resolving a track + requested to a concrete artifact
/// (Phase 18.2). Carries the bytes, the content-type that matches what was actually returned,
/// and the format actually served — which may differ from the requested one when the C2 fallback fires
/// (Opus requested, no Opus artifact → the lossless artifact + its content-type). The delivery layer
/// (18.3) sets the response Content-Type from so the eventual decoder
/// picks the right decoder for the bytes it receives, not the bytes the listener asked for.
///
/// The resolved audio artifact (never null when a resolution succeeds).
/// The MIME type of (e.g. audio/ogg for Opus,
/// or the source's real MIME for lossless).
/// The format actually returned. Equal to the requested format on a direct
/// hit; when an Opus request fell back.
public sealed record ResolvedAudio(AudioBinary Audio, string ContentType, AudioFormat ResolvedFormat)
{
/// True when an Opus request was served the lossless artifact because no Opus existed (C2).
public bool DidFallBack(AudioFormat requested) => requested != ResolvedFormat;
}