using System.Collections.Generic;
using System.Threading;
using Jellyfin.Data.Entities;
using Jellyfin.Plugin.SRFPlay.Api.Models;
using MediaBrowser.Controller.Entities;
namespace Jellyfin.Plugin.SRFPlay.Services.Interfaces;
///
/// Removes stale plugin-owned resume points so ended livestreams and abandoned playback
/// stop accumulating in every user's "Continue Watching" row.
///
public interface IResumeCleanupService
{
///
/// Scans every user's resumable items and clears the resume point of those owned by this
/// plugin that match a staleness rule. Items belonging to other plugins or to the regular
/// library are never touched.
///
///
/// When true every plugin-owned resume point is cleared regardless of the staleness rules.
/// Used by the "Clear all" maintenance action.
///
/// The cancellation token.
/// A summary of what was inspected and cleared.
ResumeCleanupResult Cleanup(bool clearAll, CancellationToken cancellationToken);
///
/// Clears the resume point of a single item for the given users.
///
/// The item whose resume point should be reset.
/// The users to clear it for.
/// A short reason, logged for traceability.
/// The number of resume points actually cleared.
int ClearResumePoint(BaseItem item, IEnumerable users, string reason);
///
/// Determines whether an item belongs to this plugin (an SRG channel item or a recording).
///
/// The item to test.
/// True if the item is owned by this plugin.
bool IsPluginItem(BaseItem item);
///
/// Clears the resume point if the item is one of this plugin's livestreams and livestream
/// cleanup is enabled. Called right after playback stops so an ended broadcast never reaches
/// "Continue Watching" in the first place, instead of waiting for the nightly task.
///
/// The item that just stopped playing.
/// The users the playback was attributed to.
/// The number of resume points cleared.
int ClearLiveStreamResumePoint(BaseItem item, IEnumerable users);
}