using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Controller.Library;
///
/// Provides similar items from the local library.
/// Returns fully resolved BaseItems directly - no additional resolution needed.
///
public interface ILocalSimilarItemsProvider : ISimilarItemsProvider
{
///
/// Determines whether the provider can handle items of the specified type.
///
/// The item type.
/// true if the provider handles this item type; otherwise false.
bool Supports(Type itemType);
///
/// Gets similar items from the local library.
///
/// The source item to find similar items for.
/// The query options (user, limit, exclusions, etc.).
/// Cancellation token.
/// The list of similar items from the library.
Task> GetSimilarItemsAsync(
BaseItem item,
SimilarItemsQuery query,
CancellationToken cancellationToken);
}
///
/// Provides similar items from the local library for a specific item type.
/// Returns fully resolved BaseItems directly - no additional resolution needed.
///
/// The type of item this provider handles.
public interface ILocalSimilarItemsProvider : ILocalSimilarItemsProvider
where TItemType : BaseItem
{
///
/// Gets similar items from the local library.
///
/// The source item to find similar items for.
/// The query options (user, limit, exclusions, etc.).
/// Cancellation token.
/// The list of similar items from the library.
Task> GetSimilarItemsAsync(
TItemType item,
SimilarItemsQuery query,
CancellationToken cancellationToken);
bool ILocalSimilarItemsProvider.Supports(Type itemType)
=> typeof(TItemType).IsAssignableFrom(itemType);
Task> ILocalSimilarItemsProvider.GetSimilarItemsAsync(
BaseItem item,
SimilarItemsQuery query,
CancellationToken cancellationToken)
=> GetSimilarItemsAsync((TItemType)item, query, cancellationToken);
}