using System;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Plugin.JRay.Models;
namespace Jellyfin.Plugin.JRay.Services.Interfaces;
///
/// Stores and retrieves truth files that were pushed to JRay directly
/// (e.g. by a remote extraction worker), independent of any sidecar file
/// on the media filesystem.
///
public interface IManagedTruthStore
{
///
/// Loads the managed truth file for the given item, if one was uploaded.
///
/// The Jellyfin library item id.
/// Cancellation token.
/// The parsed truth file, or null if none has been uploaded for this item.
Task LoadAsync(Guid itemId, CancellationToken cancellationToken);
///
/// Saves (creates or replaces) the managed truth file for the given item.
///
/// The Jellyfin library item id.
/// The truth file contents to persist.
/// How this truth data was obtained.
/// Cancellation token.
/// A task that completes when the file has been written.
///
/// Provenance is written beside the truth file, never into it: the bytes
/// served back must be the bytes the producer wrote (JR-004).
///
Task SaveAsync(Guid itemId, TruthFile truth, TruthProvenance provenance, CancellationToken cancellationToken);
///
/// Loads the provenance recorded alongside an item's managed truth data.
///
/// The Jellyfin library item id.
/// The provenance, or null if this item has no managed truth data.
TruthProvenance? LoadProvenance(Guid itemId);
///
/// Deletes the managed truth file for the given item, if one exists.
///
/// The Jellyfin library item id.
/// true if a file was deleted; false if none existed.
bool Delete(Guid itemId);
///
/// Checks whether a managed truth file has been uploaded for the given item.
///
/// The Jellyfin library item id.
/// true if a managed truth file exists.
bool Exists(Guid itemId);
}