using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Database.Implementations.Entities;
using Jellyfin.Database.Implementations.Enums;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.MediaSegments;
namespace MediaBrowser.Controller.MediaSegments;
/// 
/// Defines methods for interacting with media segments.
/// 
public interface IMediaSegmentManager
{
    /// 
    /// Uses all segment providers enabled for the 's library to get the Media Segments.
    /// 
    /// The Item to evaluate.
    /// The library options.
    /// If set, will force to remove existing segments and replace it with new ones otherwise will check for existing segments and if found any that should not be deleted, stops.
    /// The cancellation token.
    /// A task that indicates the Operation is finished.
    Task RunSegmentPluginProviders(BaseItem baseItem, LibraryOptions libraryOptions, bool forceOverwrite, CancellationToken cancellationToken);
    /// 
    /// Returns if this item supports media segments.
    /// 
    /// The base Item to check.
    /// True if supported otherwise false.
    bool IsTypeSupported(BaseItem baseItem);
    /// 
    /// Creates a new Media Segment associated with an Item.
    /// 
    /// The segment to create.
    /// The id of the Provider who created this segment.
    /// The created Segment entity.
    Task CreateSegmentAsync(MediaSegmentDto mediaSegment, string segmentProviderId);
    /// 
    /// Deletes a single media segment.
    /// 
    /// The  to delete.
    /// a task.
    Task DeleteSegmentAsync(Guid segmentId);
    /// 
    /// Deletes all media segments of an item.
    /// 
    /// The  to delete all segments for.
    /// The cancellation token.
    /// a task.
    Task DeleteSegmentsAsync(Guid itemId, CancellationToken cancellationToken);
    /// 
    /// Obtains all segments associated with the itemId.
    /// 
    /// The .
    /// filters all media segments of the given type to be included. If null all types are included.
    /// The library options.
    /// When set filters the segments to only return those that which providers are currently enabled on their library.
    /// An enumerator of 's.
    Task> GetSegmentsAsync(BaseItem item, IEnumerable? typeFilter, LibraryOptions libraryOptions, bool filterByProvider = true);
    /// 
    /// Gets information about any media segments stored for the given itemId.
    /// 
    /// The id of the .
    /// True if there are any segments stored for the item, otherwise false.
    /// TODO: this should be async but as the only caller BaseItem.GetVersionInfo isn't async, this is also not. Venson.
    bool HasSegments(Guid itemId);
    /// 
    /// Gets a list of all registered Segment Providers and their IDs.
    /// 
    /// The media item that should be tested for providers.
    /// A list of all providers for the tested item.
    IEnumerable<(string Name, string Id)> GetSupportedProviders(BaseItem item);
}