using System.Text.Json.Serialization;
using Jellyfin.Plugin.JRay.Configuration;
namespace Jellyfin.Plugin.JRay.Models;
///
/// How a fetched manifest was aligned to the local file, recorded alongside the
/// truth data.
///
///
/// The offset is applied once, at store time (JR-030), after which the stored
/// windows look native and nothing would say they had been shifted. This block
/// is what makes that reconstructable: which comparison produced the offset, how
/// strong it was, and the local file's own signature, so a later fetch can
/// re-align without decoding the media again.
///
// TRACES: JR-047 | SR-003
public class TruthAlignment
{
/// Gets or sets which comparison produced the applied offset.
[JsonPropertyName("source")]
public AlignmentSource Source { get; set; }
/// Gets or sets the tier that was applied.
[JsonPropertyName("tier")]
public MatchTier Tier { get; set; }
/// Gets or sets the offset applied to every window, in seconds.
[JsonPropertyName("offset_sec")]
public double OffsetSec { get; set; }
///
/// Gets or sets the local alignment's score, or null when none was
/// computed.
///
[JsonPropertyName("score")]
public double? Score { get; set; }
///
/// Gets or sets the recovered slide between the two analysis windows, in
/// frames, or null when no local alignment was computed.
///
///
/// Only part of : the rest comes from the two windows
/// being anchored at different points when the runtimes differ.
///
[JsonPropertyName("offset_frames")]
public int? OffsetFrames { get; set; }
///
/// Gets or sets the local file's own v1: audio signature, or
/// null when none was computed.
///
///
/// Kept so a later fetch can align against a new manifest without running
/// FFmpeg over the media again — the expensive half of the operation, and
/// the reason signatures are opt-in. It never leaves the instance: it is
/// stored beside the truth file, and contribution strips provenance
/// entirely (JR-034).
///
[JsonPropertyName("local_signature")]
public string? LocalSignature { get; set; }
///
/// Gets or sets the offset the server claimed, retained even when a local
/// alignment superseded it.
///
[JsonPropertyName("server_offset_sec")]
public double ServerOffsetSec { get; set; }
/// Gets or sets the tier the server claimed.
[JsonPropertyName("server_tier")]
public MatchTier ServerTier { get; set; }
}